OptionaldocumentDOM document override (used by default browser bridge only).
Defaults to document when available. Set to null to disable the silent-audio
prime entirely — useful in unit tests. Ignored when hostBridge is provided.
OptionalhostOptional pluggable backend for metadata/state mirroring + OS action handling. When provided, the service delegates setMetadata / setPlaybackState / onAction to the bridge and skips navigator.mediaSession entirely. When omitted, the service internally uses createBrowserMediaBridge as the default. See HostMediaBridge.
OptionalmaxMaximum active and pending sessions per endpoint. Default: 16.
OptionalmediaMediaSession target override (used by default browser bridge only).
Defaults to navigator.mediaSession when running in a browser. Pass a
MockMediaSession in unit tests. Ignored when hostBridge is provided.
OptionalonCalled when a napplet declares capabilities for a session.
OptionalonCalled when a napplet creates a session. May inspect/record the session.
OptionalonCalled when a napplet destroys a session.
OptionalonCalled when a napplet updates session metadata.
OptionalonCalled on media.state updates — high-frequency; keep handler work minimal.
OptionalplaybackPolicy-mediated shell-owned audio/video backend. Omit to reject shell ownership.
Optional host callbacks for the media service.
Host shells can hook session creation and state updates to drive their own UI (e.g., now-playing banner) without replacing the ServiceHandler wholesale.
Example