Media & Capture

Media Session

Probing…

Media Session is a web platform capability in the Media & Capture category. Integrate with OS media controls and lock-screen UI. Supported in Chromium 73+, Firefox 82+, and Safari 15+.

Try it

Loading demo…

Code

navigator.mediaSession.metadata = new MediaMetadata({
  title: 'Web Capabilities Tone',
  artist: 'MediaSession Demo',
  album: 'Browser APIs',
})

navigator.mediaSession.setActionHandler('play', () => resume())
navigator.mediaSession.setActionHandler('pause', () => pause())
navigator.mediaSession.setActionHandler('nexttrack', () => skip())

Browser support

Chromium
73
Firefox
82
Safari
15

Frequently asked questions

Which browsers support Media Session?

Supported in Chromium 73+, Firefox 82+, and Safari 15+.

Does Media Session require HTTPS?

No. Media Session works without a secure context, though serving your site over HTTPS is always recommended.

What is Media Session used for?

Integrate with OS media controls and lock-screen UI.

Can I try Media Session in my browser?

Yes. shwcs.net runs a live Media Session demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗