volumio-client is a client-side JS library/module for interact with a Volumio2 device through the WebSocket API.
The volumio-client socket layer is powered by Socket.io, socket.io-client must be import/require before using volumio-client.
You can download and serve the files volumio-client.js found in the dist folder and the socket.io.js.
Like a script:
<script src="/socket.io.js"></script>
<script src="/volumio-client.js"></script>
<script>
let myVolumio = new VolumioClient('http://volumio.local/);
myVolumio.play();
myVolumio.playPlaylist();
</script>Class representing a volumio2 device.
Kind: inner class of volumio-client
- volumio-client
- Install:
- Use:
- API Reference:
- volumio-client~VolumioClient
- new VolumioClient(host, [debug])
- volumioClient.host ⇒
string - volumioClient.debug ⇒
boolean - volumioClient.debug
- volumioClient.isConnected
- volumioClient.changeHost(host)
- volumioClient.on(eventName, callback)
- volumioClient.off(eventName, callback)
- volumioClient.emit(message, data, [callback])
- volumioClient.getState() ⇒
none - volumioClient.play()
- volumioClient.pause()
- volumioClient.stop()
- volumioClient.prev()
- volumioClient.next()
- volumioClient.seek(sec)
- volumioClient.repeat()
- volumioClient.shuffle()
- volumioClient.volumeTo(value)
- volumioClient.volumeUp()
- volumioClient.volumeDown()
- volumioClient.toggleMute()
- volumioClient.listPlaylist() ⇒
none - volumioClient.playPlaylist(playlistName)
- volumio-client~VolumioClient
Creates an instance of VolumioClient.
| Param | Type | Default | Description |
|---|---|---|---|
| host | string |
URL or IP of the volumio device. Default "http://volumio.local" | |
| [debug] | boolean |
false |
If true, active console debuging. |
Get the URL or IP of the volumio socket device
Kind: instance property of VolumioClient
Returns: string - URL or IP of the volumio device
Read only: true
Get the state of the console debuging option
Kind: instance property of VolumioClient
Returns: boolean - Debug option status
Read only: true
Set the console debuging option
Kind: instance property of VolumioClient
| Param | Type | Description |
|---|---|---|
| value | boolean |
Active or not the console debuging option |
Whether or not the socket is connected to the device.
Kind: instance property of VolumioClient
Read only: true
Change the volumio device.
Kind: instance method of VolumioClient
| Param | Type | Description |
|---|---|---|
| host | string |
URL or IP of the volumio device. |
Register a listener for the given event from volumio device. eventName refer to the official event name of Volumio WebSocket APIs.
Kind: instance method of VolumioClient
Access: public
| Param | Type | Description |
|---|---|---|
| eventName | string |
Event name("pushState", "pushListPlaylist",...) |
| callback | function |
The callback that handles the response. |
Remove the listener for the given event from volumio device. eventName refer to the official event name of Volumio WebSocket APIs.
Kind: instance method of VolumioClient
Access: public
| Param | Type | Description |
|---|---|---|
| eventName | string |
Event name("pushState", "pushListPlaylist",...) |
| callback | function |
The callback that handles the response. |
Generic method for emits/sends a message to the socket. Use this if a command is not implemented, refer to the official WebSocket APIs.
Kind: instance method of VolumioClient
| Param | Type | Description |
|---|---|---|
| message | string |
Event name |
| data | * |
Serializable datastructures |
| [callback] | function |
Optional, function that will be called with the server answer. |
Get Player State, output through pushState event.
Kind: instance method of VolumioClient
Returns: none - NO return, you need to catch through pushState event.
Play Playback Commands
Kind: instance method of VolumioClient
pause Playback Commands
Kind: instance method of VolumioClient
stop Playback Commands
Kind: instance method of VolumioClient
prev Playback Commands
Kind: instance method of VolumioClient
next Playback Commands
Kind: instance method of VolumioClient
seek Playback Commands
Kind: instance method of VolumioClient
| Param | Type | Description |
|---|---|---|
| sec | integer |
sec is the time in seconds that the playback will keep |
Toggle the repeat Playback Commands
Kind: instance method of VolumioClient
Toggle the shuffle Playback Commands
Kind: instance method of VolumioClient
Set the volume to a percentage level.
Kind: instance method of VolumioClient
| Param | Type | Description |
|---|---|---|
| value | integer |
value between 0 and 100. |
Raise the volume
Kind: instance method of VolumioClient
Lower the volume
Kind: instance method of VolumioClient
Toggle the mute Playback Command
Kind: instance method of VolumioClient
lists all playlists in the system,output through event pushListPlaylist.
Kind: instance method of VolumioClient
Returns: none - NO return, you need to catch through pushListPlaylist event.
This method clears the queue, adds the playlist and play
Kind: instance method of VolumioClient
| Param | Type | Description |
|---|---|---|
| playlistName | string |
The exact name of the playlist. |