Difference between revisions of "Documentation:Modules/mqtt"

From VideoLAN Wiki
Jump to navigation Jump to search
(Restructured as a table of commands and responses)
 
Line 57: Line 57:
 
== Protocol ==
 
== Protocol ==
  
<big>&#x2192;</big> : From client to VLC <br />
 
<big>&#x2190;</big> : From VLC to client <br />
 
  
 +
=== Commands ===
  
=== &#x2192; vlc/command   <cmd> <arguments> ===
+
Sent from client to VLC.
The following commands are accepted:
+
 
:{|
+
{| class="wikitable"
 +
|-
 +
! Direction !! Topic !! Payload !! Description
 +
|-
 +
| <big>&#x2192;</big> || vlc/command || <cmd> <arguments> || Any of the below
 
|-
 
|-
| '''add''' || <uri> || add <uri> to playlist
+
| <big>&#x2192;</big> || vlc/command/add || <url> || Add <url> to the playlist
 
|-
 
|-
| '''delete''' || <pos> || delete item <pos> in playlist
+
| <big>&#x2192;</big> || vlc/command/delete || <pos> || delete item <pos> in playlist
 
|-
 
|-
| '''clear''' ||  || clear the playlist
+
| <big>&#x2192;</big> || vlc/command/clear ||  || clear the playlist
 
|-
 
|-
| '''play''' || <pos> || Start playing item <num>
+
| <big>&#x2192;</big> || vlc/command/play || <pos> || Start playing item at <pos>
 
|-
 
|-
| '''pause''' ||   || Pause playback
+
| <big>&#x2192;</big> || vlc/command/pause || || Pause Playback
 
|-
 
|-
| '''stop''' ||   || Stop stream
+
| <big>&#x2192;</big> || vlc/command/stop || || Stop Playback
 
|-
 
|-
| '''goto''' || <pos> || Goto item at index
+
| <big>&#x2192;</big> || vlc/command/goto || <pos> || Goto item at index <pos>
 
|-
 
|-
| '''next''' ||  || Start playing next item in playlist
+
| <big>&#x2192;</big> || vlc/command/next ||  || Start playing next item in playlist
 
|-
 
|-
| '''prev''' ||  || Start playing previous item in playlist
+
| <big>&#x2192;</big> || vlc/command/prev ||  || Start playing prev item in playlist
 
|-
 
|-
| '''seek''' || <time> || Seek to <time> in the current item (in seconds)
+
| <big>&#x2192;</big> || vlc/command/seek || <time> || Seek to <time> in the current item (in seconds)
 
|-
 
|-
| '''volume''' || <volume> || Set volume to <volume> (0 to 255)
+
| <big>&#x2192;</big> || vlc/command/volume || <vol> || Set volume to <vol> (0 to 255)
 
|-
 
|-
| '''volup''' || <volume> || Increase volume by <volume>
+
| <big>&#x2192;</big> || vlc/command/volup || <vol> || Increase volume by <vol>
 
|-
 
|-
| '''voldown''' || <volume> || Descrease volume by <volume>
+
| <big>&#x2192;</big> || vlc/command/voldown || <vol> || Decrease volume by <vol>
 
|-
 
|-
| '''repeat''' || <mode> || Turn on or off playlist repeat mode (0 or 1)
+
| <big>&#x2192;</big> || vlc/command/repeat || <mode> || Turn on or off playlist ''repeat'' mode (0 or 1)
 
|-
 
|-
| '''random''' || <mode> || Turn on or off playlist random/shuffle mode (0 or 1)
+
| <big>&#x2192;</big> || vlc/command/random || <mode> || Turn on or off playlist ''random'' mode (0 or 1)
 
|-
 
|-
| '''loop''' || <mode> || Turn on or off playlist loop mode (0 or 1)
+
| <big>&#x2192;</big> || vlc/command/loop || <mode> || Turn on or off playlist ''loop'' mode (0 or 1)
 
|-
 
|-
 
|}
 
|}
  
=== &#x2190; vlc/status/playlist ===
 
A JSON representation of the playlist is sent whenever the playlist changes.
 
  
 +
=== Status ===
  
=== &#x2190; vlc/status/state ===
+
Sent from VLC to client.
This retained message is sent by VLC whenever the player changes state.
+
 
:{|
+
{| class="wikitable"
 
|-
 
|-
| '''opening''' ||
+
! Direction !! Topic !! Payload !! Description
 
|-
 
|-
| '''buffering''' ||
+
| <big>&#x2190;</big> || vlc/status/playlist || <json> || A JSON representation of the playlist is sent whenever the playlist changes.
 
|-
 
|-
| '''playing''' ||  
+
| <big>&#x2190;</big> || vlc/status/state || <state> || This retained message is sent by VLC whenever the player changes state:
 +
* opening
 +
* buffering
 +
* playing
 +
* paused
 +
* stopped
 +
* ended
 +
* error
 +
* notconnected
 
|-
 
|-
| '''paused''' ||  
+
| <big>&#x2190;</big> || vlc/status/playing || <json> || Information about the currently playing item as JSON is sent whenever a new item starts playing.
 
|-
 
|-
| '''stopped''' ||  
+
| <big>&#x2190;</big> || vlc/status/time || <time> || Progress through the current stream as decimal seconds
 
|-
 
|-
| '''ended''' ||  
+
| <big>&#x2190;</big> || vlc/status/length || <time> || Duration of current stream as decimal seconds
|-
 
| '''error''' ||  
 
|-
 
| '''notconnected''' || sent when VLC disconnects from the broker
 
 
|-
 
|-
 +
| <big>&#x2190;</big> || vlc/status/volume || <vol> || The current volume between 0 and 255 (inclusive)
 
|}
 
|}
 
=== &#x2190;  vlc/status/playing ===
 
Information about the currently playing item as JSON is sent whenever a new item starts playing.
 
 
 
=== &#x2190;  vlc/status/time ===
 
Progress through the current stream as decimal seconds
 
 
 
=== &#x2190;  vlc/status/length ===
 
Duration of current stream as decimal seconds
 
 
 
=== &#x2190;  vlc/status/volume ===
 
The current volume between 0 and 255 (inclusive)
 
  
  
 
[[Category:Interfaces]]
 
[[Category:Interfaces]]

Latest revision as of 10:31, 5 May 2014

NOTE: this module is in active development and has not made it into the main tree yet.

Module: mqtt
Type Interface
First VLC version -
Last VLC version -
Operating system(s) Any that support the mosquitto library
Description control VLC using the MQTT protocol
Shortcut(s) -

This module will let you send control messages to VLC using the MQTT protocol.

Options

  • mqtt-host <string> : Hostname of MQTT broker to connect to default value: localhost
  • mqtt-port <integer> : Port number of MQTT broker to connect to default value: 1883
  • mqtt-username <string> : The username to connect to the broker with default value: none
  • mqtt-password <string> : The password to connect to the broker with default value: none
  • mqtt-prefix <string> : The topic name prefix to use default value: vlc/
  • mqtt-clientid <string> : The client identifier to connect to the broker as default value: random
  • mqtt-keepalive <string> : The keep alive time for the MQTT protocol (in seconds) default value: 10
  • mqtt-qos <string> : The QoS level to publish and subscribe using (0, 1 or 2) default value: 1

Protocol

Commands

Sent from client to VLC.

Direction Topic Payload Description
vlc/command <cmd> <arguments> Any of the below
vlc/command/add <url> Add <url> to the playlist
vlc/command/delete <pos> delete item <pos> in playlist
vlc/command/clear clear the playlist
vlc/command/play <pos> Start playing item at <pos>
vlc/command/pause Pause Playback
vlc/command/stop Stop Playback
vlc/command/goto <pos> Goto item at index <pos>
vlc/command/next Start playing next item in playlist
vlc/command/prev Start playing prev item in playlist
vlc/command/seek Seek to
vlc/command/volume <vol> Set volume to <vol> (0 to 255)
vlc/command/volup <vol> Increase volume by <vol>
vlc/command/voldown <vol> Decrease volume by <vol>
vlc/command/repeat <mode> Turn on or off playlist repeat mode (0 or 1)
vlc/command/random <mode> Turn on or off playlist random mode (0 or 1)
vlc/command/loop <mode> Turn on or off playlist loop mode (0 or 1)


Status

Sent from VLC to client.

Direction Topic Payload Description
vlc/status/playlist <json> A JSON representation of the playlist is sent whenever the playlist changes.
vlc/status/state <state> This retained message is sent by VLC whenever the player changes state:
  • opening
  • buffering
  • playing
  • paused
  • stopped
  • ended
  • error
  • notconnected
vlc/status/playing <json> Information about the currently playing item as JSON is sent whenever a new item starts playing.
vlc/status/time Progress through the current stream as decimal seconds
vlc/status/length Duration of current stream as decimal seconds
vlc/status/volume <vol> The current volume between 0 and 255 (inclusive)