Jump to content

# MPRIS

2 languages

- 日本語
- 中文（简体）

From ArchWiki

MPRIS (Media Player Remote Interfacing Specification) is a standard D-Bus interface which aims to provide a common programmatic API for controlling media players.

It provides a mechanism for discovery, querying and basic playback control of compliant media players, as well as a track list interface which is used to add context to the active media item.

## Supported clients

This article or section needs expansion.

Reason: You can see your player of choice and check if it supports MPRIS with playerctl utility. In case it does, add it to the following list. (Discuss in Talk:MPRIS)

- Audacious
- brave-nightly-binAUR
- celluloid
- Chromium
- clementineAUR
- cmus
- deadbeefAUR (using deadbeef-mpris2-pluginAUR)
- dragon
- feishinAUR
- fooyin-binAUR
- Firefox
- gmusicbrowserAUR
- guayadequeAUR
- KDE#KDE Connect
- mpv#mpv-mpris
- Music Player Daemon/Tips and tricks#MPRIS support
- ncspot
- N Music
- plattenalbumAUR
- Quod Libet
- rage
- resonanceAUR
- smf-dsp-gitAUR
- Spotify#MPRIS
- spotify-player
- spotube-binAUR
- strawberry
- Telegram
- tidal-hifi-binAUR
- Vermilion
- VLC

## Control utilities

Tip: Create a key binding for common control commands and multimedia keys such as `XF86AudioPlay`, `XF86AudioPause`, `XF86AudioStop`, `XF86AudioPrev` and `XF86AudioNext`.

### Playerctl

The playerctl utility provides a command line tool to send commands to MPRIS clients. The most common commands are `play-pause`, `next`, `previous` and `stop`:

    $ playerctl play-pause
    $ playerctl next
    $ playerctl previous
    $ playerctl stop

playerctl will send the command to the first player it finds. To select a player manually, use the `--player` option, e.g. `--player=vlc`. For better automation playerctl comes with a daemon that keeps track of media player activity and directs commands to the one with most recent activity. You can spun it into the background with:

    $ playerctld daemon

In order to start playerctld when you log in, you may create the following systemd/User service:

    ~/.config/systemd/user/playerctld.service

    [Unit]
    Description=Keep track of media player activity

    [Service]
    Type=oneshot
    ExecStart=/usr/bin/playerctld daemon

    [Install]
    WantedBy=default.target

You should then do a daemon-reload before enabling the service with the `--user` flag.

Tip: The playerctld-systemd-unitAUR package can be installed instead of manually creating the service.

Additionally, playerctld has the ability to change an "active" player, which can be useful when you have multiple simultaneous media streams:

To switch to the next player, use:

    $ playerctld shift

To switch to the previous player, use:

    $ playerctld unshift

### 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 with the supported Methods:

    $ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Method

Similarly using busctl(1):

    $ busctl --user call org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Method

## Bluetooth

Media control from Bluetooth headsets and similar devices may be forwarded to MPRIS.

Note: Some headphones such as Sony WH-1000XM3 provide an AVRCP interface. For these types mpris-proxy is not required. Just make sure you have key bindings set up for media keys.

Install the bluez-utils package and run `mpris-proxy`. In order to start up mpris-proxy in the background and/or when your system starts, start/enable `mpris-proxy.service` with the `--user` flag.

Category:

- Multimedia

Hidden category:

- Pages or sections flagged with Template:Expansion