Jump to content

DianeTereshko

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by DianeTereshko

  1. Add this to navigator object, it is really cool,

     

    <video id="media" width="300" height="300" controls></video>
    
    navigator.getWebcam = (navigator.getUserMedia || navigator.webKitGetUserMedia || navigator.moxGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
    if (navigator.mediaDevices.getUserMedia) {
        navigator.mediaDevices.getUserMedia({
                audio: true,
                video: true
            })
            .then(function (stream) {
                var video = document.getElementById("media");
                video.srcObject = stream;
                video.play();
     
            })
            .catch(function (e) {
                logError(e.name + ": " + e.message);
            });
    } else {
        navigator.getWebcam({
                audio: true,
                video: true
            },
            function (stream) {
                //Display the video stream in the video object
            },
            function () {
                logError("Web cam is not accessible.");
            });
    }

    This show your web cam in web-page

×
×
  • Create New...