A Pen by A Non Ymous on CodePen.
Created
October 7, 2013 08:09
-
-
Save anonymous/6864186 to your computer and use it in GitHub Desktop.
A Pen by Secret Sam.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<video src=""></video> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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