首页 > 解决方案 > 在 NodeCameraView React Native 中默认设置后置摄像头

问题描述

我试图在 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 选项,但它没有打开任何相机(无论是正面还是背面)。

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

请让我知道默认使用后置摄像头的设置。

提前致谢。

标签: androidreact-nativenode-media-server

解决方案


<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
    />

推荐阅读