Skip to main content

Interface: PositionAnchor

Defined in: packages/media-session/src/specs/media-session.nitro.ts:653

The position anchor. The single most important type in this package.

Position is never streamed: the app broadcasts {value, at, rate} only on a discontinuity (seek, pause, resume, rate change, track change) and every surface extrapolates locally. Android feeds it to SimpleBasePlayer's position supplier; iOS feeds it to MPNowPlayingInfoPropertyElapsedPlaybackTime

  • ...PlaybackRate, which the system extrapolates for the lock screen.

Clock domains

at is a wall-clock timestamp (Date.now()), because that is the only clock JS has. Both native sides convert it into their own monotonic clock at the instant the broadcast is received:

ageMs = wallClockNow() - at // milliseconds this anchor is stale
anchor = monotonicNow() - ageMs // same instant, monotonic domain

Doing the conversion once, on arrival, bounds the error to the JS→native latency (sub-millisecond) instead of letting an NTP step or a suspend/resume corrupt the projection forever.

Properties

at

at: number;

Defined in: packages/media-session/src/specs/media-session.nitro.ts:657

Date.now() when value was sampled.


rate

rate: number;

Defined in: packages/media-session/src/specs/media-session.nitro.ts:662

Rate the position advances at from at onwards. 0 freezes the projection (paused/buffering), 1 is normal speed.


value

value: number;

Defined in: packages/media-session/src/specs/media-session.nitro.ts:655

Playback position in milliseconds at instant at.