Documentation
    Preparing search index...

    Function createBrowserMediaBridge

    • Reference browser implementation of HostMediaBridge.

      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.

      Parameters

      • opts: { documentTarget?: Document | null; mediaSessionTarget?: MediaSessionTarget } = {}
        • OptionaldocumentTarget?: Document | null

          Override document (tests; pass null to disable silent-audio prime).

        • OptionalmediaSessionTarget?: MediaSessionTarget

          Override navigator.mediaSession (tests).

      Returns HostMediaBridge