Build metadata, configure action handlers, and integrate with OS media controls
Detecting browser capabilities
Play audio with full Media Session integration. OS media controls will reflect the current track.
Configure MediaMetadata properties. Changes apply to the active media session in real-time.
Add artwork in various sizes. Browsers pick the best match for the display context.
Toggle handlers for media session actions. Enabled handlers will respond to OS media controls.
Control playback position reported to the OS. setPositionState() updates scrubbers in OS media controls.
Simulated preview of how your metadata appears in OS-level media controls.
Copy this code to integrate Media Session API into your own project.