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)
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.
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)
setFile
: set currently playing filesetShot
: set screenshot file pathsetState
: set player state (playing or not)setQuit
: notify the tool that player has quit, and the SMTC should be clearedpid={num}
: the player's pid. This is a mandatory parameter for every command, it is used to identify different instances.socket_name={String}
: the name of MPV's input-ipc-server socket. This is mandatory for every command, and the value is directly the name string.setFile
title={hexString}
: the title of the media fileartist={hexString}
: the artist of the media file, music files only. The value can be empty.path={hexString}
: the path of the media filetype={music,video,image}
: the type of the media filesetShot
shot_path={hexString}
: the path of the thumbnail image file. The value can be empty.The hexString
mentioned above means the original string should be encoded to hex, e.g. Hello <=> 48656C6C6F
setState
playing={bool}
: if the media is being played, true
for playing, false
for pausingsetQuit
quit=true
: this is always true if you want to quitThe 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
.