小编Mik*_*ail的帖子

GetUserMedia - facingmode

我目前正在使用Android平板电脑和GetUserMedia在我的程序中拍照.

显然,GetUserMedia使用的默认摄像头是前置摄像头.如何使用后置摄像头作为默认设置?

这是我的GetUserMedia代码:

        navigator.getUserMedia({
            "audio": false,
            "video": {
                mandatory: {
                    minWidth: this.params.dest_width,
                    minHeight: this.params.dest_height,
                    //facingMode: "environment",
                },
            }
        }, 
        function(stream) {
            // got access, attach stream to video
            video.src = window.URL.createObjectURL( stream ) || stream;
            Webcam.stream = stream;
            Webcam.loaded = true;
            Webcam.live = true;
            Webcam.dispatch('load');
            Webcam.dispatch('live');
            Webcam.flip();
        },
        function(err) {
            return self.dispatch('error', "Could not access webcam.");
        });
Run Code Online (Sandbox Code Playgroud)

我在"强制"部分插入了facingMode,但没有工作.

请帮忙.

javascript getusermedia

12
推荐指数
2
解决办法
2万
查看次数

标签 统计

getusermedia ×1

javascript ×1