我正在使用 JavaScript 开发一个地铁应用程序,并试图同时显示来自网络摄像头的两个视频(其中一个最终将应用过滤器)。但是,每当我尝试将它们都设置为将网络摄像头用作源时,我都会收到错误消息,,,,有没有解决这种情况的好方法?
谢谢!
编辑:这是一些代码:
(Javascript)
var mediaCaptureMgr = new Windows.Media.Capture.MediaCapture();
var captureInitSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
//...set properties of captureInitSettings...
mediaCaptureMgr.initializeAsync(captureInitSettings).then(function (result) {
var video1 = id("Video1"); //function to get html element with id
video1.src = URL.createObjectURL(mediaCaptureMgr, false); //does not matter if false is switched to true
var video2 = id("Video2");
video2.src = video1.src;//could also use var x = URL.create... then set video1.src/video2.src = x; still won't work.
},
errorHandler);
(HTML)
<video id="Video1" autoplay></video>
<video id="Video2" autoplay></video>
我可以通过 Click 事件或 Load 事件触发 JS——没关系——只有 Video1 获取网络摄像头视频。视频 2 不起作用。想法?
谢谢!