is there any way to control an already running VLC player on ubuntu. For example, i am trying to start a vlc video full screen with a default audio.
and then contro
The script player control from exic's answer is just a wrapper for some dbus
commands.
To use them without the script, try the following:
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
The last PlayPause
can be replaced with, e.g., Play
, Pause
, Previous
, Next
.
If you have qdbus
installed, it can be used as an alternative to dbus-send
:
qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
A list of all available calls can be obtained by leaving out the last argument:
qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2
If you enable the HTTP remote interface on VLC, you can control VLC remotely with a web browser, or even an app on your phone.
With the HTTP interface enabled, you can also use wget or curl commands to send commands.
For example, enable VLC's HTTP interface (default port: 8080) with "password" for a password. Then you can issue curl commands, either remotely or locally:
To pause:
curl -s -o /dev/null -u :password http://192.168.1.11:8080/requests/status.xml?command=pl_pause
To play:
curl -s -o /dev/null -u :password http://192.168.1.11:8080/requests/status.xml?command=pl_play
To play a specific playlist entry number:
curl -s -o /dev/null -u :password http://192.168.1.11:8080/requests/status.xml?command=pl_play&id=22
To change volume:
curl -s -o /dev/null -u :password http://192.168.1.11:8080/requests/status.xml?command=volume&val=133
Other command info: https://wiki.videolan.org/VLC_HTTP_requests/
Have you looked at the rc (remote control) interface ? It controls a VLC process via a Unix Domain Socket. See here and here for more info.
I'm controlling it remotely using dbus. VLC has implemented the MPRIS2 specification:
Control player (e. g. run player-control vlc toggle
)
Get current status (with argument vlc
)