Mirrors metadata to navigator.mediaSession.metadata (via the DOM
MediaMetadata constructor when available; plain-object fallback in test
envs). Mirrors playback state to navigator.mediaSession.playbackState
with the canonical mapping: 'playing' maps to 'playing', 'paused' maps to
'paused', 'buffering' maps to 'paused', 'stopped' maps to 'none'. Installs
setActionHandler callbacks for play/pause/nexttrack/previoustrack/seekto
that fan into the onAction subscriber with the mapped MediaAction literal
(and value from details.seekTime for seekto). When setActiveSession is
called with a non-null actions parameter, only the declared actions get
active handlers — the remaining are cleared (matching the capabilities
narrowing behavior of Plan 27-01's inline implementation).
Installs a silent-audio prime (4 kHz silent WAV data URL) when the first
session becomes active (setActiveSession called with a non-null sessionId) —
browsers refuse to render OS media controls without a playing audio element.
Removes the element when destroySession brings the active session count to
zero.
Reference browser implementation of HostMediaBridge.
Mirrors metadata to
navigator.mediaSession.metadata(via the DOMMediaMetadataconstructor when available; plain-object fallback in test envs). Mirrors playback state tonavigator.mediaSession.playbackStatewith the canonical mapping: 'playing' maps to 'playing', 'paused' maps to 'paused', 'buffering' maps to 'paused', 'stopped' maps to 'none'. InstallssetActionHandlercallbacks for play/pause/nexttrack/previoustrack/seekto that fan into the onAction subscriber with the mappedMediaActionliteral (andvaluefromdetails.seekTimefor seekto). WhensetActiveSessionis called with a non-nullactionsparameter, only the declared actions get active handlers — the remaining are cleared (matching the capabilities narrowing behavior of Plan 27-01's inline implementation).Installs a silent-audio prime (4 kHz silent WAV data URL) when the first session becomes active (setActiveSession called with a non-null sessionId) — browsers refuse to render OS media controls without a playing audio element. Removes the element when destroySession brings the active session count to zero.