Skip to content

Instantly share code, notes, and snippets.

Created October 7, 2013 08:09
Show Gist options
  • Save anonymous/6864186 to your computer and use it in GitHub Desktop.
Save anonymous/6864186 to your computer and use it in GitHub Desktop.
A Pen by Secret Sam.
<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);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment