Skip to content

Instantly share code, notes, and snippets.

@ToshihiroGoto
Created August 13, 2015 07:42
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 ToshihiroGoto/ce4f3d591df143fa8d31 to your computer and use it in GitHub Desktop.
Save ToshihiroGoto/ce4f3d591df143fa8d31 to your computer and use it in GitHub Desktop.
var initializeVideoStream = function(stream) {
var video = document.getElementById('videoTag');
if (typeof (video.srcObject) !== 'undefined') {
video.srcObject = stream;
}
else {
video.src = URL.createObjectURL(stream);
}
// 止まっている場合は強制的に再生
if (video.paused) video.play();
};
navigator.getUserMedia({ video: true }, initializeVideoStream, getUserMediaError);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment