Web Locks and Media Session
Lets a page coordinate tabs and show media controls on the lock screen.
In one line
Can coordinate work across your open tabs and show media controls on your lock screen
Lets a page coordinate tabs and show media controls on the lock screen.
Media Session exposes title and artwork to OS media UI. Web Locks coordinates work across tabs.
What it can and can't do
What the user does: You play a podcast or video, or open the same site in two tabs
It can
- Show the title and artwork in your lock screen and notification controls
- Let play and pause buttons from your headphones or keyboard reach the page
- Make two tabs of the same site take turns doing a job
It cannot
- See other sites' tabs
- See what other apps are playing
- Take over your controls when another app is playing
- Learn anything about you from this alone
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 73 | 2019-03-12 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Supported | 82 | 2020-10-20 | None |
| Safari | Supported | 15 | 2021-09-20 | None |
| Safari on iPhone | Supported | 15 | 2021-09-20 | None |
| Chrome on Android | Supported | 57 | 2017-03-16 | None |
| Samsung Internet | Supported | 7.0 | 2018-03-16 | None |
How a site asks for it
| API | navigator.locks.request(name,cb); navigator.mediaSession.metadata |
| Browser compat keys | api.MediaSession |
| How access is granted | none |
| What the user sees | None |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | Per origin |
| How to take it back | Site settings |
| Inside an iframe | Same as top level; cross-origin iframes need a permissions policy where listed |
Typical flow
- Call the API
- Browser applies its access rules
- Page receives the result
Data you get
What comes back: Lets a page coordinate tabs and show media controls on the lock screen.
Shape: object
How often: on demand
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
metadata | object | None | title, artist, album, artwork[] | Not listed |
Technical limits
- Media Session only for playing media
- Web Locks scoped to origin
The story
What it is
A page can coordinate its own tabs, and show play and pause controls on your lock screen.
For you
You see the song title, picture and play buttons on your lock screen and in your car. Pressing a headphone button pauses the page. Behind the scenes, tabs avoid fighting over the same job.
For makers
Makers get a polished player with lock screen controls and clean tab behavior. Locks stop two tabs doing the same work, such as syncing twice. Both are quiet features that make web apps feel native.
Where you see it
| Type | Example | Apps |
|---|---|---|
| music | A web music player shows the song, cover art and skip buttons on your phone lock screen. | YouTube Music |
| video | A video site shows play, pause and seek controls on the lock screen and a smart watch. | YouTube |
| games | A browser game with sound pauses music when you press pause on your headphones. | None named |
| productivity | A web editor uses locks so only one open tab syncs your document at a time. | Google Docs |
| live | A live radio or podcast site shows the show name on the lock screen. | None named |
| automotive | A web player shows track info on a car display when your phone is connected. | None named |
| messaging | A web chat uses locks so only one tab plays the message sound. | Slack |
Risks
- Little risk
- Tab behavior surprises
What the platform says
- web.dev: Media Session API. Lets a page show track info and play controls on the lock screen, headphones and car displays.
Good uses and abuse
Legitimate uses
- Podcasts
Known abuse
- None
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2018, Chrome 69: Web Locks
- 2019, Chrome 73: Media Session
Sources
How well checked: Checked against real behavior.