Download this package
open terminal cd into this directory and run node app.js
<video src=""></video> |
navigator.getMedia = ( navigator.getUserMedia || | |
navigator.webkitGetUserMedia || | |
navigator.mozGetUserMedia || | |
navigator.msGetUserMedia); | |
navigator.getMedia ( | |
// constraints | |
{ | |
video: { | |
mandatory: { | |
chromeMediaSource: 'screen', | |
maxWidth: 1280, | |
maxHeight: 800 | |
} | |
}, | |
// successCallback | |
function(localMediaStream) { | |
var video = document.querySelector('video'); | |
video.src = window.URL.createObjectURL(localMediaStream); | |
video.onloadedmetadata = function(e) { | |
// Do something with the video here. | |
}; | |
}, | |
// errorCallback | |
function(err) { | |
console.log("The following error occured: " + err); | |
} | |
); |