Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/datasone/MPVMediaControl
Windows 10 System Media Transport Controls (SMTC) for MPV (or any other programs)
https://github.com/datasone/MPVMediaControl
Last synced: 3 months ago
JSON representation
Windows 10 System Media Transport Controls (SMTC) for MPV (or any other programs)
- Host: GitHub
- URL: https://github.com/datasone/MPVMediaControl
- Owner: datasone
- License: mit
- Created: 2021-09-18T12:35:05.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-13T15:21:30.000Z (6 months ago)
- Last Synced: 2024-06-30T14:50:39.417Z (4 months ago)
- Language: C#
- Size: 226 KB
- Stars: 58
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mpv - MPVMediaControl - Windows 10 System Media Transport Controls (SMTC). (Other)
README
# 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
- Media metadata display including title and artist information
- Thumbnail generated from mpv screenshot or youtube cover image
- Media controls (play/pause, prev, next)## 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](https://devblogs.microsoft.com/commandline/tar-and-curl-come-to-windows/). 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
- `setFile`: set currently playing file
- `setShot`: set screenshot file path
- `setState`: set player state (playing or not)
- `setQuit`: notify the tool that player has quit, and the SMTC should be cleared### Parameters
- Common parameters
- `pid={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.
- Though Windows allows Unicode named pipes, it will make things more complex and I didn't see any benefits to use non-ASCII characters.
- Parameters for `setFile`
- `title={hexString}`: the title of the media file
- `artist={hexString}`: the artist of the media file, music files only. The value can be empty.
- `path={hexString}`: the path of the media file
- `type={music,video,image}`: the type of the media file
- Parameters for `setShot`
- `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`
- Parameters for `setState`
- `playing={bool}`: if the media is being played, `true` for playing, `false` for pausing
- Parameters for `setQuit`
- `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`.