Add offscreen user media sample#1056
Conversation
|
@patrickkettner |
|
@oliverdunk |
| "content_scripts": [ | ||
| { | ||
| "matches": ["<all_urls>"], | ||
| "js": ["contentScript.js"] |
There was a problem hiding this comment.
you can do just this
| "js": ["contentScript.js"] | |
| "js": ["contentScript.js", "requestPermissions.js"] |
and run it without all the fuss with iframes, messaging to offscreen and back
There was a problem hiding this comment.
however I still get permission in prompt state, so I am probably missing something from your code
There was a problem hiding this comment.
#821 : The reason for requesting mic and cam permissions inside the iframe is because we want to ask for the permissions on behalf of the extension app (eg -> "[myExtension] wants to Use" instead of "www.google.com wants to use your camera and microphone") and hold onto the permissions across all tabs, only asking once for the permissions.
Your suggestion of injecting CS directly via manifest will not help in accomplishing above goal. But will definitely ease around the fuss if you don't need it in the context of your extension.
Attaching a snapshot for reference how your suggested code will ask for permissions.
Let me know if I am missing out something in your proposed flow.
Thanks.
|
hi @aakash232, I am really sorry this never got a proper review. your PR proved out the core idea here (grant mic to the extension origin from a page, record in the offscreen document) and #1717 builds on exactly that, in a smaller shape that avoids the all_urls content script. closing in favor of that one, and thank you for working out the hard part. |

This recipe shows how to use User Media in an Extension Service Worker using the Offscreen document.
The extension aims to capture audio from the user in the context of extension (globally) via a media recorder in the offscreen document.
Aims to add a new sample fixing the issue : MV3 user's mic and cam permissions using iframe
Fixes #821