Skip to content

Instantly share code, notes, and snippets.

/test_gist Secret

Created March 25, 2014 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/0d9ad88e1d1193254dab to your computer and use it in GitHub Desktop.
Save anonymous/0d9ad88e1d1193254dab to your computer and use it in GitHub Desktop.
navigator.getMedia = ( navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
function mycallbackExpectedFailure(err) {
console.log(err);
}
navigator.getMedia (
// constraints
{
video: true,
audio: true
},
// successCallback
function(localMediaStream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(localMediaStream);
video.onloadedmetadata = function(e) {
// Do something with the video here.
};
}, mycallbackExpectedFailure
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment