datasone / MPVMediaControl

Windows 10 System Media Transport Controls (SMTC) for MPV (or any other programs)
MIT License
67 stars 4 forks source link

MPVMediaControl

This tool adds SMTC feature to mpv player, it communicates with mpv by named pipe, and can be controlled by any other programs.

Screenshot on Windows 11 22000 (It's much more useable than the one in 10)

Features

Usage

Put notify_media.lua in mpv's scripts directory and place MPVMediaControl.exe to ~~/bin.

You can change the default settings via the notify_media.conf file.

A Reset SMTC item in menu will reset the state of SMTC, useful when Windows is glitched and controls are not working properly (e.g. not displaying or disappearing).

For retrieving youtube cover image, curl.exe is used. It has been bundled in Windows 10 since 1803, or actually build 17063. So if you are using older versions of Windows, you may need to manually download and put curl.exe into $PATH.

Protocol

This tool listens on a named pipe called mpvmcsocket, and receives commands through this protocol:

[commandName](param1=value1)(param2=value2)...

e.g.

[setState](pid=1000)(playing=true)

Commands

Parameters

The hexString mentioned above means the original string should be encoded to hex, e.g. Hello <=> 48656C6C6F

The media control part works by sending commands to mpv's ipc socket, which notify_media.lua will set mpv to listen on, with the configured socket_name in notify_media.conf.