Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome packaged apps: Permission for getUserMedia() audio input

I'm porting my web app over to a Chrome packaged app and I heavily use the Web Audio API (which works great), but I use getUserMedia() to get line in audio. Normally a status bar comes down asking for permission from the user. In a packaged app this does not happen and error 1 (permission denied) is thrown. Has anyone had any experience with this in a packaged app setting or know if there is a certain permission I need to add?

Oh, I also did some research and found some bugs filed with chrome on it but I don't know if any of them have been implemented yet.

like image 618
Steel Avatar asked Feb 19 '23 07:02

Steel


1 Answers

You have to add the proper permissions in your manifest.json. Then it should inform the user when they install your app.

  "permissions": [
    "audioCapture", 
    "videoCapture"
  ]

You can use one or the other depending on what type of request you're passing as a parameter to getUserMedia(), that is {audio:true} or {video:true}, respectively.

like image 108
codeisforeva Avatar answered Feb 21 '23 01:02

codeisforeva