Giter Club home page Giter Club logo

Comments (5)

youennf avatar youennf commented on September 28, 2024

In WebKit, there is support for passing null instead as a means of clearing the position state

I don't think this is valid to pass a null dictionary member as a method argument, WebKit implementation should probably be updated.

I think Chrome is supporting both setPostionState() and setPositionState({}) to clear the state.
But the latter throws in WebKit so maybe we could outlaw it.

If we agree on this, one possible WebIDL is:

dictionary MediaPositionState {
    required double duration; // make it required
    double playbackRate = 1; // add a default value
    double position = 0; // add a default value
}
partial interface MediaSession {
    undefined clearPositionState(); // needed?
    undefined setPositionState(); // clear state, same as above
    undefined setPositionState(MediaPositionState state);  // set state
}

from mediasession.

steimelchrome avatar steimelchrome commented on September 28, 2024

Is there a reason WebKit needs to throw on setPositionState({})? The spec currently allows the website to send an empty MediaPositionState to clear it and only requires duration to be set for a non-empty MediaPositionState, which feels reasonable to me, and then the interface is just:

partial interface MediaSession {
  undefined setPositionState(optional MediaPositionState state = {});
}

from mediasession.

marcoscaceres avatar marcoscaceres commented on September 28, 2024

@steimelchrome, what you propose (with addition of @youennf's defaults) sounds quite reasonable to me and, as @youennf points out, it indeed does away with the need for clearPositionState().

We can update WebKit to match. Would you match it in Chrome?

from mediasession.

steimelchrome avatar steimelchrome commented on September 28, 2024

I think the required on duration would prevent that from working, right? Should we remove that and then in the setPositionState() steps insist that duration must exist if the given position state is not empty?

from mediasession.

marcoscaceres avatar marcoscaceres commented on September 28, 2024

Yes, that would make sense, and it would be easy to enforce.

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.