Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何通过videojs录制将正面摄像头切换到背面摄像头进行图像拍摄?_Javascript_Record_Video.js_Video Camera_Videojs Record - Fatal编程技术网

Javascript 如何通过videojs录制将正面摄像头切换到背面摄像头进行图像拍摄?

Javascript 如何通过videojs录制将正面摄像头切换到背面摄像头进行图像拍摄?,javascript,record,video.js,video-camera,videojs-record,Javascript,Record,Video.js,Video Camera,Videojs Record,这适用于视频(将代码片段摄影机更改为背面摄影机) 但类似地,对于图像,并没有任何改变。 照相机仍然相同(仅正面照相机) 我对imagePlayer的选择是 const options = { controls: true, width: width, height: height, controlBar: { volumePane

这适用于视频(将代码片段摄影机更改为背面摄影机)

但类似地,对于图像,并没有任何改变。 照相机仍然相同(仅正面照相机)

我对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>
很高兴有任何帮助或线索来解决相机切换问题

imagePlayer.record().recordImage = {deviceId: {exact: 'backface-camera-device-id'}};
imagePlayer.record().stopDevice();
imagePlayer.record().getDevice();

对我有效。

到目前为止,您尝试了哪些方法?您是否尝试过将
video:{deviceId:{exact:deviceId}}
传递给初始值设定项,而不是随后进行设置?@milgner,我已经尝试过这两种方法,
video:{deviceId:{exact:deviceId}
image:{deviceId:{exact:deviceId}
-仍然只对视频有效,但是对于image-不起作用。@Andrii没有关于这个问题的任何更新。我也有同样的问题
<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
                    }
                }
            };
imagePlayer.record().recordImage = {deviceId: {exact: 'backface-camera-device-id'}};
imagePlayer.record().stopDevice();
imagePlayer.record().getDevice();