Skip to content

Instantly share code, notes, and snippets.

@benbrittain
Created July 27, 2012 20:03
Show Gist options
  • Save benbrittain/3190180 to your computer and use it in GitHub Desktop.
Save benbrittain/3190180 to your computer and use it in GitHub Desktop.
function initMedia() {
if(navigator.webkitGetUserMedia) {
navigator.webkitGetUserMedia({audio: true}, onSuccess, onFail);
} else {
alert('webRTC not available');
}
}
function onSuccess(stream) {
document.getElementById('audio').src = webkitURL.createObjectURL(stream);
state.localStream = stream;
if (state.initiator) maybeStart();
}
function onFail() {
alert('could not connect stream');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment