Bug 259642 - MediaSession.setPositionState() does not allow duration Infinity
Summary: MediaSession.setPositionState() does not allow duration Infinity
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 16
Hardware: Mac (Apple Silicon) macOS 13
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-07-31 02:40 PDT by Jakob Wierzba
Modified: 2024-01-30 15:35 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakob Wierzba 2023-07-31 02:40:05 PDT
Per spec https://w3c.github.io/mediasession/#the-mediapositionstate-dictionary

> positive infinity can be used to indicate media without a defined end such as live playback

but when I do

navigator.mediaSession.setPositionState({ duration: Infinity })

I get a

> TypeError: The provided value is non-finite
Comment 1 Radar WebKit Bug Importer 2023-08-07 02:41:13 PDT
<rdar://problem/113493417>
Comment 2 Jer Noble 2023-08-10 12:48:52 PDT
This is (currently) intentional (and the spec text is confusing). The MediaSession specification defines `duration` to be a `double`, whereas the HTMLMediaElement.duration is defined as a `unrestricted 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.
Comment 3 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