Created
May 29, 2015 15:53
-
-
Save DaveVoyles/2ac04742e50fc1d8fe3e to your computer and use it in GitHub Desktop.
InitializeVideoStream - Get User Media
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
// initializeVideoStream() - Callback function when getUserMedia() returns successfully with a mediaStream object | |
// 1. Set the mediaStream on the video tag | |
// 2. Use 'srcObject' attribute to determine whether to use the standard-based API or the legacy version | |
var initializeVideoStream = function(stream) { | |
mediaStream = stream; | |
var video = document.getElementById('videoTag'); | |
if (typeof (video.srcObject) !== 'undefined') { | |
video.srcObject = mediaStream; | |
} | |
else { | |
video.src = URL.createObjectURL(mediaStream); | |
} | |
if (webcamList.length > 1) { | |
document.getElementById('switch').disabled = false; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment