MPRIS
MPRIS (Media Player Remote Interfacing Specification) はメディアプレイヤーを制御するための共通のプログラマティック API を提供することを目的とした標準 D-Bus インターフェイスです。
準拠するメディアプレイヤーの発見、問い合わせ、基本的な再生制御のためのメカニズムや、アクティブなメディアアイテムにコンテンキストを追加するために使用するトラックリストインターフェイスを提供します。
サポートしているクライアント
- Chromium
- Firefox
- Dragon Player
- mpv#mpv-mpris
- Music Player Daemon/Tips and tricks#MPRIS support
- rageAUR
- Spotify#MPRIS
- ncspotAUR
- Telegram
- VLC
- celluloid
コントロールユーティリティ
Playerctl
The playerctl utility provides a command line tool to send commands to MPRIS clients. The most common commands are play-pause
, next
and previous
:
$ playerctl play-pause $ playerctl next $ playerctl previous
playerctl will send the command to the first player it finds. To select a player manually, use the --player
option, e.g. --player=vlc
.
mpris-player-control
The mpris_player_control is a shell script which integrates dbus-send
and pactl
to control MPRIS clients. It supports the Play, Pause, PlayPause and Stop actions and sink volume control (mute/unmute/up/down) for Spotify.
Run mpris_player_control -h
to show basic script usage.
D-Bus
An alternative to the above is to manually use D-Bus, which should be available by default as it is a dependency of systemd.
For example, the following commands can be used to control Spotify:
$ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause $ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next $ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous $ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop
Bluetooth
Media control from bluetooth headsets and similar devices may be forwarded to MPRIS.
インストール the bluez-utils package and run mpris-proxy
. In order to start up mpris-proxy in the background and/or when your system starts, you may create a systemd/ユーザー service:
~/.config/systemd/user/mpris-proxy.service
[Unit] Description=Forward bluetooth media controls to MPRIS [Service] Type=simple ExecStart=/usr/bin/mpris-proxy [Install] WantedBy=default.target