【问题标题】:Setting Back camera by default in NodeCameraView React Native在 NodeCameraView React Native 中默认设置后置摄像头
【发布时间】:2021-10-28 06:50:52
【问题描述】:

我尝试在 react native 中使用名为 react-native-nodemediaclient 的包来让 Live Stream 工作并让它工作。

这里我们默认打开前置摄像头,我们可以切换摄像头视图。但是,我希望默认打开后置摄像头。

这是我使用的打开前置摄像头的摄像头设置。

videoSettings = {
  preset: 12,
  bitrate: 400000,
  profile: 1,
  fps: 15,
  videoFrontMirror: false,
};

cameraSettings = {cameraId: 1, cameraFrontMirror: true};

我已经修改了相机 ID 和 cameraFrontMirror 选项,但它没有打开任何相机(无论是正面还是背面)。

搜索了谷歌,但没有任何工作。

请告诉我默认使用后置摄像头的设置。

提前致谢。

【问题讨论】:

    标签: android react-native node-media-server


    【解决方案1】:
    <NodeCameraView 
      style={{ width: WIDTH, height: HEIGHT }}
    
      ref={(vb) => {
            setVbRef(vb);
                }}
    
     outputUrl={rtmpUrl}
    
     camera={{ 
       cameraId: 0, 
       cameraFrontMirror: false 
    }}
    
    audio={{
      bitrate: 32000,
      profile: 1, 
      samplerate: 44100 
    }}
    
    video={{
      preset: 12,
      bitrate: 400000,
      profile: 1,
      fps: 30,
      videoFrontMirror: false,
    }}
     autopreview
        />
    

    【讨论】:

    • 只需在你的 cameraSettings 中添加 cameraId:0 和 cameraFrontMirror: false
    • 感谢您的建议。将尝试让您知道结果
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多