这适用于视频(代码片段摄像头更改为背面摄像头)
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
}
}
};很高兴有任何帮助或线索来解决相机切换问题!
发布于 2020-10-29 05:38:55
imagePlayer.record().recordImage = {deviceId: {exact: 'backface-camera-device-id'}};
imagePlayer.record().stopDevice();
imagePlayer.record().getDevice();对我很管用。
https://stackoverflow.com/questions/60018726
复制相似问题