Skip to content

Instantly share code, notes, and snippets.

@anantn

anantn/tamejs_gum.js

Created Oct 18, 2012
Embed
What would you like to do?
TameJS wrapper for getUserMedia
function myGetUserMedia(constraints, cb)
{
function errCb(code)
{
cb(code, null);
}
function successCb(stream)
{
cb(null, stream);
}
if (navigator.mozGetUserMedia) {
navigator.mozGetUserMedia(constraints, successCb, errCb);
} else if (navigator.webkitGetUserMedia) {
navigator.webkitGetUserMedia(constraints, successCb, errCb);
} else {
cb("NOT_SUPPORTED", null);
}
}
await {
myGetUserMedia(constraints, defer(var err, var stream));
}
if (!err && navigator.mozGetUserMedia) {
video.mozSrcObject = stream;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment