Xubuntuに入れたVLCメディアプレイヤーをHTTP経由でリモートからDVD再生します。
前提
商用DVDを再生する場合、必要な手順が完了していること。
具体的には、
sudo apt-get install libdvdread4 sudo /usr/share/doc/libdvdread4/install-css.sh
たぶん、こんな感じ。
準備
デフォルトではリモートからのアクセスが制限されています。
/etc/vlc/lua/http/.hosts
を編集し、
192.168.0.0/16
のコメントを外します。
cvlc -d --intf http --http-port 8080
VLCをリモートから制御するために、HTTPインターフェースを8080ポートで待ち受けるように指定してデーモン起動します。(cvlcというはVLCのコマンドライン版で、GUIなしに動作するVLCです。)
DVD制御
curl "http://localhost:8080/requests/status.xml?command=in_play&input=dvd:///dev/cdrom"
HTTPインターフェースでVLCを操作する場合、基本的に /requests/status/xml に対してパラメタを付与することになります。
上記では in_play (再生)と input (ソース)を指定します。
input にはMRLという書式で指定します。
DVD再生を行う場合は dvd:// + デバイスのパス です。
うちの環境では /dev/cdrom ですが、環境によってパスは変わるのでご自身の環境に合わせて読み替えてください。
curl "http://localhost:8080/requests/status.xml?command=pl_stop"
DVDの停止に限らないですが。再生中のものを停止します。
curl "http://localhost:8080/requests/status.xml?command=key&val=nav-left" curl "http://localhost:8080/requests/status.xml?command=key&val=nav-right" curl "http://localhost:8080/requests/status.xml?command=key&val=nav-up" curl "http://localhost:8080/requests/status.xml?command=key&val=nav-down" curl "http://localhost:8080/requests/status.xml?command=key&val=nav-activate"
DVDメニュー時の操作。nav-activateが決定です。
curl "http://localhost:8080/requests/status.xml?command=fullscreen"
フルスクリーン(トグル)
curl "http://localhost:8080/requests/status.xml?command=seek&val=0"
先頭に戻る。valは秒単位。 +60 と指定すると60秒進む。 -30 で30秒戻る。
curl "http://localhost:8080/requests/status.xml?command=volume&val=100%"
音量調節。0~100。+や-をつけての相対指定も可能。
今回は便宜上 localhost 上で curl を使ってHTTPインターフェースを叩いてますが、
もちろんリモートからHTTP通信することで同様に実行できます。
参考
http://htlab.net/blog/2012/06/26/vlc-remote/
https://wiki.videolan.org/VLC_HTTP_requests/
https://forum.videolan.org/viewtopic.php?t=31871