Media playback notifications for Chrome on Android

Chrome 45 Beta introduces a handy new feature for controlling audio and video playback.

When an audio or video element is playing on a web page, a notification showing the page title and a play/pause button is displayed in the notification tray and on the lock screen. The notification can be used to pause or resume play, and to quickly return to the page that is playing the media.

Great for controlling music apps and for many other audio and video use cases.

Notification displayed over a web page
Notification displayed over a web page
Notification displayed over the Android lock screen
Notification displayed over the Android lock screen

The screencast below shows the process of displaying a notification and controlling video playback on a web page:

Note that:

  • Notifications are only shown for media over five seconds in length.
  • There is no notification for audio from the Web Audio API unless it is played back via an audio element.

With the Media Session API, you can customize media notifications by providing metadata for the media your web app is playing. This API also allows you to handle media related events such as seeking or track changing which may come from notifications or media keys.