Reputation: 2787
i have code like this
function initAudio() {
if (!navigator.webkitGetUserMedia)
return(alert("Error: getUserMedia not supported!"));
navigator.webkitGetUserMedia({audio:true}, gotStream, function(e) {
alert('Error getting audio');
console.log(e);
});
}
window.addEventListener('load', initAudio );
my output in console is this
NavigatorUserMediaError {code: 1, PERMISSION_DENIED: 1}
why permission deny for me? I try to make audio recorder from source code of this page http://webaudiodemos.appspot.com/AudioRecorder/index.html
Upvotes: 2
Views: 5089
Reputation: 10258
If your running your code from a file saved on your machine not through a web server, chrome sometimes has issues with allowing access due to its secuirty policy.
Two options to try are
Opening chrome through terminal using the command below if you are on mac
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files
Upvotes: 4