Skip to main content

MediaSessionInit

Options to create a media session.

Properties​

PropertyTypeDescription
handlers?Partial<Record<ExtendedMediaSessionAction, MediaSessionActionHandler>>Handlers to register, keyed by the action they handle. Actions without a handler are left untouched, allowing the platform to fall back to its default behavior.
metadata?MediaSessionMetadataInitInitial metadata to present.
playbackState?MediaSessionPlaybackStateInitial playback state, defaults to playing.
positionState?MediaPositionStateInitial playback position to present.
applyImperativeCaptureState?booleanApply the capture state even when the platform implements it as a command that mutes the real tracks, defaults to false. Only enable this when every call is made from a user gesture handler, otherwise unmuting is rejected and the capture stays muted.
mediaSession?MediaSessionLikeThe media session implementation to use, defaults to navigator.mediaSession when available.
createMetadata?(init) => MediaMetadataFactory building the metadata object, defaults to the MediaMetadata constructor when available.