Created
July 19, 2017 19:16
-
-
Save C-Rodg/1c64fe3c24e85a34d22a7eca6e0d9d68 to your computer and use it in GitHub Desktop.
Using WebRTC to request camera and microphone access in the browser.
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
navigator.getUserMedia( { video: true, audio: true }, (stream) => { | |
localStream = stream; | |
const cameraBox = document.getElementById('camera-box'); | |
cameraBox.setAttribute('src', URL.createObjectURL( stream ) ); | |
init(); | |
}, (error) => { | |
alert('error accessing usermedia ' + error.toString() ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment