Skip to content

[Feature]: Add keyboard media key support (play/pause, next, previous) to the mini-player window #60

Description

@prince-pokharna

Summary

The YTM Mini Mode extension pops YouTube Music out into a dedicated mini-player window. However, when the mini-player window is in focus, media keys on the keyboard (Play/Pause, Next Track, Previous Track) do not control YouTube Music playback. This is a significant UX gap — a mini-player that does not respond to hardware media keys defeats a primary use case of the extension: controlling music without switching context.

Problem

  • Media key events (MediaPlayPause, MediaTrackNext, MediaTrackPrevious) dispatched at the OS level are only handled by the active/focused tab in the main browser window.
  • When the mini-player window (the popped-out picture-in-picture-style window) has focus, media keys have no effect on YouTube Music playback.
  • Users who use hardware keyboards with media keys or headphone/headset controls expect these to work regardless of which window is focused.
  • This is a commonly reported friction point in browser extensions that implement pop-out players.

Impact

  • Users must switch back to the main YouTube Music tab to use media keys, directly undermining the extension's purpose.
  • Headphone users who rely on inline media controls cannot use them while the mini-player is their active window.

Proposed Solution

I would like to implement media key forwarding using the Web Extensions API within the content script or background service worker:

  1. In the mini-player window: Listen for keydown events matching MediaPlayPause, MediaTrackNext, MediaTrackPrevious.
  2. Message passing: Use chrome.runtime.sendMessage / browser.runtime.sendMessage to forward the key event to the background script.
  3. In the background script: Use chrome.tabs.sendMessage to relay the command to the main YouTube Music tab's content script.
  4. In the content script (YTM tab): Dispatch a synthetic click on the relevant YTM player button (yt-icon-button[aria-label="Play pause"], next/previous buttons).

This approach works entirely within the existing message-passing architecture the extension already uses, requires no new permissions, and is fully compatible with both Manifest V2 (Firefox) and Manifest V3 (Chrome).

I am happy to implement and test this across both browsers. Could you please assign this issue to me?

Labels: enhancement, feature request, help wanted, GSSoC 2026

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