Skip to Content
Platform.Ontology

Web Locks and Media Session

Lets a page coordinate tabs and show media controls on the lock screen.

Works without askingHome screen and system linksSystem integrationWeb browsersWhile you use it

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

BrowserStatusFirst versionReleasedNote
ChromeSupported732019-03-12None
EdgeSupported792020-01-15None
FirefoxSupported822020-10-20None
SafariSupported152021-09-20None
Safari on iPhoneSupported152021-09-20None
Chrome on AndroidSupported572017-03-16None
Samsung InternetSupported7.02018-03-16None

How a site asks for it

APInavigator.locks.request(name,cb); navigator.mediaSession.metadata
Browser compat keysapi.MediaSession
How access is grantednone
What the user seesNone
Needs a secure context (HTTPS)Yes
Needs a user gestureNo
How long it lastsPer origin
How to take it backSite settings
Inside an iframeSame as top level; cross-origin iframes need a permissions policy where listed

Typical flow

  1. Call the API
  2. Browser applies its access rules
  3. 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

FieldTypeUnitRangePrecision
metadataobjectNonetitle, 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

TypeExampleApps
musicA web music player shows the song, cover art and skip buttons on your phone lock screen.YouTube Music
videoA video site shows play, pause and seek controls on the lock screen and a smart watch.YouTube
gamesA browser game with sound pauses music when you press pause on your headphones.None named
productivityA web editor uses locks so only one open tab syncs your document at a time.Google Docs
liveA live radio or podcast site shows the show name on the lock screen.None named
automotiveA web player shows track info on a car display when your phone is connected.None named
messagingA web chat uses locks so only one tab plays the message sound.Slack

Risks

  • Little risk
  • Tab behavior surprises

What the platform says

Good uses and abuse

Legitimate uses

  • Podcasts

Known abuse

  • None

Scores

ScoreValueMeaning
Sensitivity1 of 5How revealing the data is
Utility3 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bitsNot ratedRough identifying entropy, when known

History

  • 2018, Chrome 69: Web Locks
  • 2019, Chrome 73: Media Session

Sources

How well checked: Checked against real behavior.

On this page