正在访问我网页中的网络摄像头,即使浏览器在凸轮中具有访问权限,视频也不会显示

时间:2019-02-17 08:01:34

标签: javascript

我正在尝试使用我的网站中的网络摄像头捕获照片,但问题是即使浏览器已在此处使用Java脚本访问网络摄像头,视频也未在网页中显示

  <script type ="text/javascript">
(function(){
    var video = document.getElementById('video'),
                vendorUrl = window.URL || window.webkitURL;

                navigator.getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;

                navigator.getMedia({
                    video: true,
                    audio: false    
                }, function(stream){
                        video.scr = vendorUrl.createObjectURL(stream);
                        video.play();
                }, function(error){

                });
})();

然后在这里我要显示凸轮并捕获图像

 <div class="col-lg-12">
<div class="col-lg-2">
<!--Webcam-->
     <!--<img  border-radius: 50%; src="image" alt="Student Image">-->
     <video id="video" width="200" height="200"></video>
</div>
<div class="col-lg-2">
    Select Picture File to Upload:  <input type="file" name="image">
</div>

预先感谢

1 个答案:

答案 0 :(得分:0)

错别字。应该是

video.src = ...

不是

video.scr = ...