Skip to content

phenates/volumio-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

volumio-client

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.

Install:


You can download and serve the files volumio-client.js found in the dist folder and the socket.io.js.

Use:


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>

API Reference:


volumio-client~VolumioClient

Class representing a volumio2 device.

Kind: inner class of volumio-client

new VolumioClient(host, [debug])

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.

volumioClient.host ⇒ string

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

volumioClient.debug ⇒ boolean

Get the state of the console debuging option

Kind: instance property of VolumioClient
Returns: boolean - Debug option status
Read only: true

volumioClient.debug

Set the console debuging option

Kind: instance property of VolumioClient

Param Type Description
value boolean Active or not the console debuging option

volumioClient.isConnected

Whether or not the socket is connected to the device.

Kind: instance property of VolumioClient
Read only: true

volumioClient.changeHost(host)

Change the volumio device.

Kind: instance method of VolumioClient

Param Type Description
host string URL or IP of the volumio device.

volumioClient.on(eventName, callback)

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.

volumioClient.off(eventName, callback)

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.

volumioClient.emit(message, data, [callback])

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.

volumioClient.getState() ⇒ none

Get Player State, output through pushState event.

Kind: instance method of VolumioClient
Returns: none - NO return, you need to catch through pushState event.

volumioClient.play()

Play Playback Commands

Kind: instance method of VolumioClient

volumioClient.pause()

pause Playback Commands

Kind: instance method of VolumioClient

volumioClient.stop()

stop Playback Commands

Kind: instance method of VolumioClient

volumioClient.prev()

prev Playback Commands

Kind: instance method of VolumioClient

volumioClient.next()

next Playback Commands

Kind: instance method of VolumioClient

volumioClient.seek(sec)

seek Playback Commands

Kind: instance method of VolumioClient

Param Type Description
sec integer sec is the time in seconds that the playback will keep

volumioClient.repeat()

Toggle the repeat Playback Commands

Kind: instance method of VolumioClient

volumioClient.shuffle()

Toggle the shuffle Playback Commands

Kind: instance method of VolumioClient

volumioClient.volumeTo(value)

Set the volume to a percentage level.

Kind: instance method of VolumioClient

Param Type Description
value integer value between 0 and 100.

volumioClient.volumeUp()

Raise the volume

Kind: instance method of VolumioClient

volumioClient.volumeDown()

Lower the volume

Kind: instance method of VolumioClient

volumioClient.toggleMute()

Toggle the mute Playback Command

Kind: instance method of VolumioClient

volumioClient.listPlaylist() ⇒ none

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.

volumioClient.playPlaylist(playlistName)

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.

About

Javascript module for the volumio WebSocket API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors