【问题标题】:How to switch frontface camera to backface camera via videojs-record for image capturing?如何通过 videojs-record 将前置摄像头切换到后置摄像头进行图像捕获?
【发布时间】:2020-02-01 16:15:58
【问题描述】:

这适用于视频(将代码 sn-p 摄像头更改为背面摄像头)

 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
                    }
                }
            };

很高兴得到解决相机切换问题的任何帮助或线索!

【问题讨论】:

  • 到目前为止您尝试了哪些方法?您是否尝试过将 video: { deviceId: {exact: deviceId} } 传递给初始化程序而不是事后设置?
  • @milgner,video: { deviceId: {exact: deviceId} }image: { deviceId: {exact: deviceId} } 我都试过了 - 仍然只适用于视频,但对于图像 - 不起作用。
  • @Andrii 有关此问题的任何更新。我也有同样的问题

标签: javascript record video.js video-camera videojs-record


【解决方案1】:
imagePlayer.record().recordImage = {deviceId: {exact: 'backface-camera-device-id'}};
imagePlayer.record().stopDevice();
imagePlayer.record().getDevice();

为我工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多