コンテンツにスキップ

「MPRIS」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
序文を飜訳
Kgx (トーク | 投稿記録)
Bluetooth: 情報を更新
 
(2人の利用者による、間の7版が非表示)
1行目: 1行目:
[[Category:Multimedia]]
[[Category:マルチメディア]]
[[en:MPRIS]]
[[en:MPRIS]]
[https://specifications.freedesktop.org/mpris-spec/latest/ MPRIS] (Media Player Remote Interfacing Specification) はメディアプレイヤーを制御するための共通のプログラマティック API を提供することを目的とした標準 [[D-Bus]] インターフェイスです。
[https://specifications.freedesktop.org/mpris-spec/latest/ MPRIS] (Media Player Remote Interfacing Specification) はメディアプレイヤーを制御するための共通のプログラマティック API を提供することを目的とした標準 [[D-Bus]] インターフェイスです。
7行目: 7行目:
== サポートしているクライアント ==
== サポートしているクライアント ==


* [[Audacious]]
* {{Pkg|celluloid}}
* [[Chromium]]
* [[Chromium]]
* {{AUR|clementine}}
* [[Firefox]]
* [[cmus]]
* {{AUR|deadbeef}} (using {{AUR|deadbeef-mpris2-plugin}})
* [[wikipedia:Dragon_Player|Dragon Player]]
* [[wikipedia:Dragon_Player|Dragon Player]]
* [[Firefox]]
* {{AUR|gmusicbrowser}}
* {{AUR|guayadeque}}
* [[KDE#KDE Connect]]
* [[mpv#mpv-mpris]]
* [[mpv#mpv-mpris]]
* [[Music Player Daemon/Tips and tricks#MPRIS support]]
* [[Music Player Daemon/Tips and tricks#MPRIS support]]
* {{AUR|rage}}
* {{Pkg|ncspot}}
* [[Quod Libet]]
* {{Pkg|rage}}
* {{AUR|resonance}}
* {{AUR|smf-dsp-git}}
* [[Spotify#MPRIS]]
* [[Spotify#MPRIS]]
* {{AUR|ncspot}}
* {{AUR|spotube-bin}}
* [[Telegram]]
* [[Telegram]]
* {{AUR|tidal-hifi-bin}}
* [[VLC]]
* [[VLC]]
* {{Pkg|celluloid}}
* {{AUR|brave-nightly-bin}}


== コントロールユーティリティ ==
== コントロールユーティリティ ==


{{Tip|Create a [[キーバインド]] for common control commands and multimedia keys such as {{ic|XF86AudioPlay}}, {{ic|XF86AudioStop}}, {{ic|XF86AudioPrev}} and {{ic|XF86AudioNext}}.}}
{{Tip|{{ic|XF86AudioPlay}} {{ic|XF86AudioStop}}{{ic|XF86AudioPrev}}{{ic|XF86AudioNext}} などの一般的な制御コマンドとマルチメディアキーの[[キーボードショートカット]] を作成します。}}


=== Playerctl ===
=== Playerctl ===


The {{Pkg|playerctl}} utility provides a command line tool to send commands to MPRIS clients. The most common commands are {{ic|play-pause}}, {{ic|next}} and {{ic|previous}}:
{{Pkg|playerctl}} ユーティリティは、MPRIS クライアントにコマンドを送信するためのコマンドラインツールを提供します。最も一般的なコマンドは、{{ic|play-pause}}{{ic|next}}、および {{ic|previous}} です:


$ playerctl play-pause
$ playerctl play-pause
31行目: 44行目:
$ playerctl previous
$ playerctl previous


''playerctl'' は、最初に見つけたプレイヤーにコマンドを送信します。プレーヤーを手動で選択するには、{{ic|--player}} オプション (例: {{ic|1=--player=vlc}}) を使用します。自動化を向上させるために、''playerctl'' には、メディアプレーヤーのアクティビティを追跡し、最新のアクティビティを持つものにコマンドを送信するデーモンが付属しています。次のようにしてバックグラウンドに回転させることができます。
''playerctl'' will send the command to the first player it finds. To select a player manually, use the {{ic|--player}} option, e.g. {{ic|1=--player=vlc}}.


$ playerctld daemon
=== mpris-player-control ===


ログイン時に ''playerctld'' を開始するには、次の [[systemd/ユーザー]] サービスを作成します。
The [https://gitlab.com/axdsop/nix-dotfiles/tree/master/Configs/polybar/scripts/mpris_player mpris_player_control] is a shell script which integrates {{ic|dbus-send}} and {{ic|pactl}} to control MPRIS clients. It supports the Play, Pause, PlayPause and Stop actions and sink volume control (mute/unmute/up/down) for [[Spotify]].


{{hc|~/.config/systemd/user/playerctld.service|output=
Run {{ic|mpris_player_control -h}} to show basic script usage.
[Unit]
Description=Keep track of media player activity

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

[Install]
WantedBy=default.target
}}

次に、{{ic|--user}} フラグを使用してサービスを [[有効化]] する前に [[daemon-reload]] を実行する必要があります。

{{Tip|{{AUR|playerctld-systemd-unit}} パッケージは、サービスを手動で作成する代わりにインストールできます。}}

さらに、''playerctld'' には ''アクティブな'' プレーヤーを変更する機能があり、複数の同時メディア ストリームがある場合に便利です。

次のプレーヤーに切り替えるには、次を使用します:

$ playerctld shift

前のプレーヤーに切り替えるには、次を使用します:

$ playerctld unshift

=== mpris-プレイヤーコントロール ===

[https://gitlab.com/axdsop/nix-dotfiles/tree/master/Configs/polybar/scripts/mpris_player mpris_player_control] は {{ic|dbus-send}} と {{ic|pactl}} を統合して MPRIS クライアントを制御するシェルスクリプトです。再生、一時停止、PlayPause、停止の各操作と、[[Spotify]] の音量調整(ミュート/アンミュート/アップ/ダウン)をサポートしています。

{{ic|mpris_player_control -h}} を実行すると、スクリプトの基本的な使い方が表示されます。


=== D-Bus ===
=== D-Bus ===


[[D-Bus]] は [[systemd]] に依存しているため、デフォルトで利用できるはずです。
An alternative to the above is to manually use [[D-Bus]], which should be available by default as it is a dependency of [[systemd]].


例えば、以下のようなコマンドで [[Spotify]] を制御することができます。
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.PlayPause
52行目: 95行目:
== Bluetooth ==
== Bluetooth ==


Bluetooth ヘッドセットおよび同様のデバイスからのメディア制御は、MPRIS に転送される場合があります。
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 [[キーバインド]] set up for media keys.}}
{{Note|Sony WH-1000XM3 などの一部のヘッドフォンは、AVRCP インターフェイスを提供します。これらのタイプの場合、''mpris-proxy'' は必要ありません。メディアキー用に [[キーバインド]] が設定されていることを確認してください。}}


[[インストール]] the {{Pkg|bluez-utils}} package and run {{ic|mpris-proxy}}. In order to start up ''mpris-proxy'' in the background and/or when your system starts, you may create a [[systemd/ユーザー]] service:
{{Pkg|bluez-utils}} パッケージを [[インストール]] し、{{ic|mpris-proxy}} を実行します。バックグラウンド、および、または、システムの起動時に ''mpris-proxy'' を起動するために、[[systemd/ユーザー]] サービスを作成できます。


{{hc|~/.config/systemd/user/mpris-proxy.service|<nowiki>
{{hc|~/.config/systemd/user/mpris-proxy.service|<nowiki>
70行目: 113行目:
</nowiki>}}
</nowiki>}}


Then [[起動]]/[[有効化]] the service with the {{ic|--user}} flag.
次に、{{ic|--user}} フラグを使用してサービスを [[起動]]/[[有効化]] します。

{{Tip|手動でサービスを作成する代わりに、{{AUR|mpris-proxy-service}} パッケージをインストールすることもできます。}}

2024年1月1日 (月) 00:50時点における最新版

MPRIS (Media Player Remote Interfacing Specification) はメディアプレイヤーを制御するための共通のプログラマティック API を提供することを目的とした標準 D-Bus インターフェイスです。

準拠するメディアプレイヤーの発見、問い合わせ、基本的な再生制御のためのメカニズムや、アクティブなメディアアイテムにコンテンキストを追加するために使用するトラックリストインターフェイスを提供します。

サポートしているクライアント

コントロールユーティリティ

ヒント XF86AudioPlay XF86AudioStopXF86AudioPrevXF86AudioNext などの一般的な制御コマンドとマルチメディアキーのキーボードショートカット を作成します。

Playerctl

playerctl ユーティリティは、MPRIS クライアントにコマンドを送信するためのコマンドラインツールを提供します。最も一般的なコマンドは、play-pausenext、および previous です:

$ playerctl play-pause
$ playerctl next
$ playerctl previous

playerctl は、最初に見つけたプレイヤーにコマンドを送信します。プレーヤーを手動で選択するには、--player オプション (例: --player=vlc) を使用します。自動化を向上させるために、playerctl には、メディアプレーヤーのアクティビティを追跡し、最新のアクティビティを持つものにコマンドを送信するデーモンが付属しています。次のようにしてバックグラウンドに回転させることができます。

$ playerctld daemon

ログイン時に playerctld を開始するには、次の systemd/ユーザー サービスを作成します。

~/.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

次に、--user フラグを使用してサービスを 有効化 する前に daemon-reload を実行する必要があります。

ヒント playerctld-systemd-unitAUR パッケージは、サービスを手動で作成する代わりにインストールできます。

さらに、playerctld には アクティブな プレーヤーを変更する機能があり、複数の同時メディア ストリームがある場合に便利です。

次のプレーヤーに切り替えるには、次を使用します:

$ playerctld shift

前のプレーヤーに切り替えるには、次を使用します:

$ playerctld unshift

mpris-プレイヤーコントロール

mpris_player_controldbus-sendpactl を統合して MPRIS クライアントを制御するシェルスクリプトです。再生、一時停止、PlayPause、停止の各操作と、Spotify の音量調整(ミュート/アンミュート/アップ/ダウン)をサポートしています。

mpris_player_control -h を実行すると、スクリプトの基本的な使い方が表示されます。

D-Bus

D-Bussystemd に依存しているため、デフォルトで利用できるはずです。

例えば、以下のようなコマンドで 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

Bluetooth ヘッドセットおよび同様のデバイスからのメディア制御は、MPRIS に転送される場合があります。

ノート Sony WH-1000XM3 などの一部のヘッドフォンは、AVRCP インターフェイスを提供します。これらのタイプの場合、mpris-proxy は必要ありません。メディアキー用に キーバインド が設定されていることを確認してください。

bluez-utils パッケージを インストール し、mpris-proxy を実行します。バックグラウンド、および、または、システムの起動時に mpris-proxy を起動するために、systemd/ユーザー サービスを作成できます。

~/.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

次に、--user フラグを使用してサービスを 起動/有効化 します。

ヒント 手動でサービスを作成する代わりに、mpris-proxy-serviceAUR パッケージをインストールすることもできます。