Manifest v3 sandboxed origin in iframe doesn't have media devices permissions

26 Views Asked by At

our sandboxed application is wrapped by a top level html, which servers as a proxy between our app and service workers.

I need access to microphone in the application, navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: 'default'}} }), but it seems like we cannot do that in a sandboxed origin? [Violation] Permissions policy violation: microphone is not allowed in this document.

I haven't seen any mention of the navigator.mediaDevices being blocked in a sandboxed origin. But if that's the case, is my only workaround to handle audio in the wrapper?

Here's what I've been trying to do

Top level wrapper:

let iframe = document.createElement('iframe'),
    appUrl = chrome.runtime.getURL('index.html');

iframe.setAttribute('src', appUrl);
iframe.setAttribute('allow', 'microphone ' + appUrl);
document.body.appendChild(iframe);

Permissions in manifest.json:

"permissions": [
    "notifications",
    "storage",
    "notifications",
    "scripting",
    "contentSettings"
],
0

There are 0 best solutions below