DianeTereshko Posted November 6, 2019 Share Posted November 6, 2019 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now