Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
972 views
in Technique[技术] by (71.8m points)

html自带的拍摄控件如何解决不高清问题

我买的高清仪设备需要做拍摄上传的功能,这个设备本身拍照是非常清楚的,但是通过html的控件拍摄就特别模糊,是控件本身的问题,还是我代码不规范?

navigator.mediaDevices
                    .getUserMedia({video:true})
                    .then(function(stream) {
                        video = document.getElementById('camera-video');
                        try {
                            video.srcObject = stream;
                        } catch (error) {
                            video.src = window.URL.createObjectURL(stream);
                        }
                        video.play();

                        //将video资源传入canvas
                    })
                    .catch(function(error) {
                        return Toastr.error('抱歉,设备连接有误');
                    });

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

已解决,在入getUserMedia入参video入参时输入需要显示的分辨路即可解决

getUserMedia({video:{ width: 1280, height: 720 }})

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...