Comments (5)
As far as I can tell, there are at most four MediaSession objects in existence, one per kind that appears in the page.
It's only the default media sessions that are per-tab, there could be any number of author-created sessions competing within each other in a page.
Note also that the per-tab session cannot be exposed to scripts, because a tab can have out-of-process iframes so that the media elements under that media sessions control don't all live in the same process.
from mediasession.
For the record, we've also considered per-element and per-document default scope of media sessions, which would certainly be simpler in some ways, but it's a larger change in behavior and thus carrier greater risk.
from mediasession.
I don't see how author-created sessions come into being or are used. There's no constructor on MediaSession, and .session
on media objects is readonly and appears to get set automatically by setting .kind
. It's possible I'm completely missing something explained in one of the algorithms, but the two examples seem to just be auto-assigning them to some UA-created sessions.
Maybe this just needs significantly improved explanations scattered through the spec; right now I don't understand what most of the algorithms are meant for. For example, I'm still not sure where the media key events get routed to your element. (In other words, the spec seems to suffer from "WHATWG disease", where it focuses mostly on just defining and invoking algorithms and leaving out almost all explanations of what those algorithms are for.)
from mediasession.
In short, MediaSession
should have a constructor, it's needed to enable the one-session-many-elements case, but @richtr only added the API yesterday so we're not there yet. Right now there's also nothing in the spec to deal with media key events, not even play/pause. I trust that before long we'll have something that enables you to write code roughly like https://github.com/whatwg/mediasession/blob/f1750b44e219814d341ebf37fcdb3d3142f1e581/MediaSession.md#example
It's true that the spec is very algorithm heavy and one basically has to read it all to understand how it's supposed to fit together. One section that I think strikes a good balance is https://mediasession.spec.whatwg.org/#media-session-interruption. Right now we want to try implementing something to see if the overall structure holds up, so basically everything may still change.
from mediasession.
Ah, okay. Sorry, since this was just posted to webapps for review, I assumed it was reasonably fleshed out. I'll hold off on further API review until this gets a little more finished. ^_^
from mediasession.
Related Issues (20)
- 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
- Add WPT mediasession permission policy tests HOT 1
- Should the default mediasession permission policy value be self instead of * HOT 4
- MediaPositionState IDL does not allow infinite duration HOT 1
- How should Media Session work with "inert" media? HOT 6
- Should there be a toggle screenshare action? HOT 5
- What is the relationship between toggle microphone/camera actions and MediaStreamTrack mute/unmute events? HOT 11
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.