<script> | |
let err = ''; | |
function gotUserMedia(mediaStream) | |
{ | |
window.webkit.messageHandlers.testHandler.postMessage('allowed'); | |
} | |
function userMediaError(error) | |
{ | |
err = `${error.name},${error.message}`; | |
window.webkit.messageHandlers.testHandler.postMessage('denied'); | |
} | |
function lastError() | |
{ | |
return err; | |
} | |
let constraints = { audio: false, video: true}; | |
navigator.mediaDevices.getUserMedia(constraints) | |
.then(gotUserMedia). | |
catch(userMediaError); | |
</script> |