这适用于视频(将代码片段相机更改为背面相机)
videoPlayer.record().stopDevice();
videoPlayer.record().setVideoInput('backface-camera-device-id');
但类比图像并没有改变任何东西。摄像头还是一样的(只有前置摄像头)
imagePlayer.record().stopDevice();
imagePlayer.record().setVideoInput('backface-camera-device-id');
我对 imagePlayer 的选择是
const options = {
controls: true,
width: width,
height: height,
controlBar: {
volumePanel: true
},
plugins: {
record: {
image: true,
imageOutputType: 'blob',
mandatory: {
minWidth: 1280,
minHeight: 720,
},
frameWidth: 1280,
frameHeight: 720,
}
}
};
const imagePlayer = videojs('image-frame', options);
图像框架是
<video id="image-frame"></video>
我的视频选项(仅适用于视频)
const options = {
controls: true,
width: width,
height: height,
fluid: false,
controlBar: {
volumePanel: false,
cameraButton: true,
},
plugins: {
record: {
audio: true,
video: true,
videoEngine: 'recordrtc',
maxLength: 120,
debug: true,
mandatory: {
minWidth: 1280,
minHeight: 720,
},
frameWidth: 1280,
frameHeight: 720,
timeSlice: 1000
}
}
};
很高兴有任何帮助或线索来解决相机切换问题!