正如我之前问过的,我正在做一个网络摄像头应用程序。
我可以检测到浏览器是否支持网络摄像头或不使用 getUserMedia 作为navigator.webkitGetUserMedia
. 但是有时计算机没有网络摄像头,那么用户媒体也是如此。我正在使用 webcam.js 框架。
在处理网络摄像头应用程序代码之前,如何知道计算机不支持网络摄像头?
this.mediaDevices.getUserMedia({
"audio": false,
"video": this.params.constraints || {
mandatory: {
minWidth: this.params.dest_width,
minHeight: this.params.dest_height
}
}
})
.then( function(stream) {
// got access, attach stream to video
alert(12);
video.src = window.URL.createObjectURL( stream ) || stream;
self.stream = stream;
self.loaded = true;
self.live = true;
self.dispatch('load');
self.dispatch('live');
self.flip();
})
.catch( function(err) {
return self.dispatch('error', "Could not access webcam: " + err.name + ": " + err.message, err);
});
如果网络摄像头不存在,则捕获块正在捕获,但如何手动捕获?