mediaSession.setPositionState 'duration' cannot be Infinity
Categories
(Core :: Audio/Video, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox91 | --- | affected |
People
(Reporter: jamie, Unassigned)
References
Details
Although the MediaSession API isn't exposing anything useful in Firefox, we are implementing it as part of a live streaming site.
The method navigator.mediaSession.setPositionState(opts)
will not accept a duration parameter of Infinity.
Although MDN & spec suggest you can pass Infinity
as a valid value for the duration
parameter - to imply that the duration is not known - on Firefox, this throws an error.
Other browsers implementing MediaSession accept Infinity
as a valid duration.
Apologies, I was wrong about other browsers accepting Infinity
as a value - just tested this on Chrome on an Android device, and it triggered the same error.
Nonetheless, this would be useful to support! (Or, perhaps, a tweak to the wording on MDN?)
Updated•4 years ago
|
Updated•3 years ago
|
Comment 2•10 months ago
|
||
I've also just hit this issue. It also affects WebKit and is apparently due to an inconsistency in the MediaSession spec which has now been resolved (https://bugs.webkit.org/show_bug.cgi?id=259642)
Jer Noble 2023-08-10 12:48:52 PDT
This is (currently) intentional (and the spec text is confusing). The MediaSession specification definesduration
to be adouble
, whereas the HTMLMediaElement.duration is defined as aunrestricted double
(thus allowing +Infinity).
This issue was raised recently in the Media WG: https://github.com/w3c/mediasession/issues/252
We'll update the definition (to allow +Infinity) when the spec changes.
Ahmad Saleem 2024-01-30 15:35:06 PST
Web-Spec thread just got closed last week: https://github.com/w3c/mediasession/pull/304
with one follow-up: https://github.com/w3c/mediasession/issues/315
Description
•