Record and save video with JavaScript

2

Hi, I'm working on a project in laravel 5.6, I want to activate the camera of the device and record a video of a few seconds, and save it on the server, for now I have this that activates the camera, I do not know what else to do to record and save in the server, here the code that I have in the moment:

<script>
    navigator.getUserMedia =
            navigator.getUserMedia ||
            navigator.webkitGetUserMedia ||
            navigator.mozGetUserMedia ||
            navigator.msGetUserMedia;
            window.URL = window.URL || 
            window.webkitURL || 
            window.mozURL || 
            window.msURL;

    var video = document.querySelector('video');

    if (navigator.getUserMedia) {    
        navigator.getUserMedia({audio: true, video: true},
        function(stream){
            var mediaRecorder = new MediaRecorder(stream);
            video.src = window.URL.createObjectURL(stream);
            console.log(video.src);
        },
        function () {
            document.writeLn("problema");
        });
    }else{
        document.writeLn("video capture no soporta");
    }
    $("#stop").click(function() {
        mediaRecorder.stop();
    });
</script>

Thank you.

    
asked by Nicolas Cardenas 05.09.2018 в 00:22
source

0 answers