Comments (3)
It is appealing to enable reuse of the same mechanism for both PiP and media capture handle.
The main difference is that PiP is a trusted source of actions (otherwise the web page would not register callbacks) but another web page might not be as trusted.
It seems reasonable that a web page would like to differentiate these two sources of actions.
If we narrow down to pages being paired through capture handle (capturer and capturee), we can think of the following approach:
- Capturer API is restricted to a reduced set of actions: play, pause, nexttrack, nextslide make sense, hangup/togglecamera/togglemicrophone do not make a lot of sense.
- Capturer gains access to this API as a result of a successful getDisplayMedia call that can list capturee supported actions and trigger actions on capturee. API is available as long as capturer getDisplayMedia track is live/not muted.
- Capturee has a way to differentiate browser trusted actions from page potentially-trusted actions.
There are various ways to implement 3, one important decision point is whether it should be opt-in or whether opt-out is deemed feasible.
The opt-out approach allows capturer to trigger actions on today's web pages that register MediaSession handlers with PiP window in mind only. This has pros and cons.
The opt-out approach could be based on capturer's origin, for instance by adding an optional origin member to MediaSessionActionDetails, something like:
partial dictionary MediaSessionActionDetails {
USVString origin;
}
A consequence of this API is that capturer would expose its origin when triggering an action.
Based on this origin member field, an opt-in approach could be implemented by extending MediaSession.setActionHandler, for instance by passing an options dictionary as third parameter, this dictionary taking a boolean, say allowCaptureHandleAction, false by default.
partial dictionary MediaSessionActionHandlerOptions {
boolean allowCaptureHandleAction = false;
}
partial interface MediaSession {
undefined setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler, MediaSessionActionHandlerOptions options);
}
from mediasession.
In the 23 May 2022 Media WG / WebRTC joint meeting, @jernoble suggested the idea that would allow a capturing page to delegate Media Session actions to a capturee page, and the UA would manage passing the actions to the capturee.
from mediasession.
Delegating Media Session actions to another page seems fine. Allowing capturing pages to trigger actions on another page though would definitely at least require an opt-in approach (so that existing pages aren't suddenly taking non-UA actions without their knowledge/consent)
from mediasession.
Related Issues (20)
- Extend MediaMetadata to capture video chapter information
- Should we add slide presentation specific actions? HOT 14
- Should we add a common repository for MediaSession actions and WebRTC capture handle actions? HOT 2
- Status of AudioFocus API HOT 4
- Definition of active media session and the togglemicrophone, togglecamera, hangup actions HOT 7
- Privacy issue: is it a good idea to let webapps lie about camera/mic ON/OFF on a user's lock screen? HOT 4
- MediaSession API on Edge in showing ANY buttons when entering picture-in-picture HOT 2
- Update explainer with video conferencing actions HOT 1
- Dedicated video conference session API? HOT 2
- Add takephoto action to spec
- The active media session might not be the only one being notified of actions
- MediaSession as a user-constructible object don't work. HOT 1
- Media Session doesn't show artwork on iOS 16.1.1 HOT 3
- mediaSession.setActionHandler not working properly with more than one video element on Chrome HOT 2
- Show album art (song cover) using media session api with jsmediatags api.
- Make PiP mediaSession Mic and Camera icons always visible HOT 1
- EnterPictureInPicture MediaSessionAction HOT 2
- Notification buttons on the lock screen HOT 2
- Top issues for TPAC 2023 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mediasession.