0

I am creating a component that allows me to create a video with the webcam, using MediaStream. I can't find how I can start recording the video. Any ideas what I will be missing?

 inicial: function (component, event, helper) {

        var width = 300; // scale the photo width to this
        var height = 0; // computed based on the input stream

        var streaming = false;
        var video = null;
        var canvas = null;
        var photo = null;
        var startbutton = null;
        video = document.getElementById('video1');
        canvas = document.getElementById('canvas');

        var streamRecorder;
        var webcamstream;

        navigator.mediaDevices.getUserMedia({
                video: true,
                audio: true
            })
            .then(function (stream) {
                video.src = window.URL.createObjectURL(stream);
                video.srcObject = stream;
                video.play();
            })
            .catch(function (err) {
                alert("An error occurred: " + err);
            });

           }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.