Giter Club home page Giter Club logo

Comments (5)

foolip avatar foolip commented on July 19, 2024

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.

foolip avatar foolip commented on July 19, 2024

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.

tabatkins avatar tabatkins commented on July 19, 2024

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.

foolip avatar foolip commented on July 19, 2024

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.

tabatkins avatar tabatkins commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.