Windows 8 (JavaScript): multiple <video> tags with the same webcam source: maybe?

I am developing a metro application using JavaScript and trying to simultaneously display two videos from a webcam (one of them, in the end, will apply a filter to it). However, I get an error message when I try to set them as to use the webcam as a source, is there a good way to convey this situation?

Thank!

Edit: Here is the code:

(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>

I can start JS through the Click event or the Load event - it doesn't matter - only Video1 receives the video in the webcam. Video2 does not work. Thoughts?

Thank!

+3
source share
1 answer

getUserMedia Chrome, , Metro , , , ?

, JavaScript javascript, , , :

var video1 = id("Video1");
var canvas = id('canvas');

var context = canvas.getContext('2d');

context.drawImage(video1, 0, 0);

, , , , - window.requestAnimationFrame.

+1

All Articles