Skip to content

Feature: Media Session API integration (OS media controls + hardware keys reflect playbackRate) #1580

Description

@chirag127

Feature request: Media Session API integration for OS media controls

When VSC changes video.playbackRate, the browser's Media Session (surfaced by Windows 11 SMTC flyout, macOS Now Playing, ChromeOS/Android media notifications) does not reflect the new rate. Reported position/duration in those OS controls drifts because the OS assumes 1.0×.

Additionally, hardware media keys and OS-level seek buttons currently route to the page's own handlers only — VSC's advance/rewind/faster/slower shortcuts aren't exposed to Media Session, so users can't drive VSC from a headset button, keyboard media keys, or the SMTC flyout.

Proposed:

  1. When VSC updates playbackRate on the active video, call navigator.mediaSession.setPositionState({ duration, position, playbackRate }) on the same element.
  2. Register setActionHandler('seekforward' | 'seekbackward') mapped to the existing advance / rewind actions (opt-in setting, off by default to avoid clobbering site handlers).

MDN refs: Media Session API, setPositionState.

Thanks for the great work on Video Speed Controller!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions