w3c / webextensions

Charter and administrivia for the WebExtensions Community Group (WECG)
Other
578 stars 50 forks source link

Proposal: Give extensions easy access to MediaSession #522

Open gregorypappas opened 5 months ago

gregorypappas commented 5 months ago

I've been prototyping a browser extension that adds play/pause buttons to the tab context menu. A problem I've run into is that there's no good way to interact with a page's MediaSession from the background. Currently, I've worked around this by using a content script and message passing. This is not good for performance and requires the scary 'Access your data for all websites' permission, which is not ideal for Manifest v3.

It'd be neat if the background service worker could:

With these capabilities, lots of cool extensions could be made. I'm not sure what a concrete API design would look like at this point.

oliverdunk commented 5 months ago

This seems like an interesting idea to me. It does feel like it would require a fairly large API surface though and with that there would be an implementation cost which I suspect would make it hard to prioritise, at least on the Chrome side.

I think it would be good to find either a browser vendor willing to prioritise this or someone willing to work on an implementation before we discuss in too much detail.

Rob--W commented 4 months ago

Discussed in today's meeting - a concrete API proposal plus willingness to provide a patch is necessary for this to move forward.

For the record, the Firefox side of this request is tracked at https://bugzilla.mozilla.org/show_bug.cgi?id=1872636