Skip to content

@capgo/capacitor-media-session

Capacitor plugin to expose media session controls of the device.

@capgo/capacitor-media-session wires your Capacitor player into the OS now playing surface: lock screen, notification controls, headsets, and CarPlay style remotes. Set title and artwork, publish playback state, and react to play, pause, seek, and skip actions from native UI.

Use it for podcasts, music, audiobooks, and long form video where users expect hardware button control.

PlatformImplementation
iOSWeb implementation adapter (navigator.mediaSession; rejects when unavailable)
AndroidMedia session service
WebMedia Session API
  • setMetadata - Sets metadata of the currently playing media.
  • setPlaybackState - Updates the playback state of the media session.
  • setActionHandler - Registers a handler for a media session action.
  • setPositionState - Updates position state for the active media session.
MethodDescription
setMetadataSets metadata of the currently playing media.
setPlaybackStateUpdates the playback state of the media session.
setActionHandlerRegisters a handler for a media session action.
setPositionStateUpdates position state for the active media session.
getPluginVersionGet the native Capacitor plugin version.

This reference is synced from src/definitions.ts in capacitor-media-session.

Keep going from @capgo/capacitor-media-session

Section titled “Keep going from @capgo/capacitor-media-session”

If you are using @capgo/capacitor-media-session to plan dashboard and API operations, connect it with Using @capgo/capacitor-media-session for the native capability in Using @capgo/capacitor-media-session, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.