If MesonCast is configured and running then you are able to connect to the radio server. You should use the following URL:
http://<server's host>:<station's port>
where \<server's host> is host name or IP address of a machine MesonCast is located on; \<station's port> is a port specified in TRANSMITTER.port.
For example:
http://localhost:8000 http://192.168.0.100:8001/ http://example.com:8080
Also, you are able to retrieve an M3U playlist which contains a stream URL as a single entry. You'll need to append "/m3u" to above mentioned station URL.
For example:
http://localhost:8000/m3u http://192.168.0.100:8001/m3u http://example.com:8080/m3u
This will give you something like this:
#EXTM3U #EXTINF:-1,Station Name http://192.168.0.100:8000
If you've specified a control password in TRANSMITTER.controlPassword then you may control the server using HTTP requests.
The common request format is as follows:
http://<server's host>:<station's port>/command?password=<controlPassword>&command=<command>&<param1>=<value1>&<param2>=<value2>
The response will be a JSON object in UTF-8. If "result" property of the returned object is 1, then request was successful, otherwise "err" property will hold a string representation of the error. Additional info can be also returned. See exmples below a table.
Command | Params | Description | Additional response JSON params |
---|---|---|---|
track | index=\<track_index> | Change the current track to \<track_index>. Indexes are zero-based. If the index is out of range, then the first track is selected. You can also specify "prev" or "next" as an index, that will switch a station to a previous or next track respectively. "index" property of response will hold an actual track index, that was actually set. If a file at a specified index cannot be played, then MesonCast tries to play next file. If none of files in the playlist cannot be played, then an error is returned. Note, that because of buffering, the tracks will not be switched instantly. | index\<current_track_index> |
stop | no | Stop the station. The station will no longer transmit any music, but it still can be accessed via HTTP requests. | no |
start | no | Start or restart the station. The playback will be resumed from the last file played. | no |
is_running | no | Returns 1 if the station is running, otherwise - returns 0. | is_running:{1 |
list | no | Returns playlist as an array. | list:[\<filename1>, \<filename2>, ...] |
listhash | no | Returns MD5 hash for a "list" command response. This is useful, when you want to know if the playlist changed or not. | hash:\<md5_hash> |
index | no | Returns current track index. Note, that the "current track" means a "track which is now decoded", so it may not be the same track your listeners are listening to. | index:\<current_track_index> |
listeners | no | Returns a number of currently connected clients. | count:\<number_of_listeners> |
ping | no | Does nothing. Useful for checking the connection only. | no |
name | no | Returns a name of the station (as specified in TRANSMITTER.name). | name:\<station_name> |
title | no | Returns a title of a current track title. Note, that the "current track" means a "track which is now decoded", so it may not be the same track your listeners are listening to. | title:\<current_track_title> |
queue | indexes=\<track index 1>, \<track index 2>, ... index=\<track index>&pos=\<insert position> |
Inserts tracks in a playback queue. If "indexes" param is specified, then the queue will be set according to provided values (this will remove an existing queue, of course). You may specify parameters "index" and "pos". This will place track number \<track index> at \<insert position> in a playback queue. If pos=0, then it will place a track at the beginning of the queue; if pos=end or not specified then a track will be placed at the end of the queue. You cannot specify "indexes" and "index" params at the same time. If no parameters are specified, then the curent queue is returned in the "queue" parameter. | queue:[\<track index 1>, \<track index 2>, ...] |
queue_remove | indexes=\<track index 1>, \<track index 2>,... | Removes tracks with specified indexes from a playback queue. | no |
nexts | count:\<number_of_indexes> | Returns \<number_of_indexes> track indexes which will be played after the current track (or after the end of the playback queue). Note, that a playback queue is ignored when processing this request, so if you've got a non-empty playback queue then you'll get a list of indexes which will be played after the queue ends. Read more about playback queues | no |
Examples:
Request (switch to a next track): http://localhost:8000/command?password=123&command=track&index=next Response: {"result":1, "index":13} Explanation: switched to a next track which index is 13 Request (switch to a track #150): http://localhost:8000/command?password=123&command=track&index=150 Response: {"result":1, "index":153} Explanation: tried to switch to track #150, but failed; invalid track were skipped; now playing track #153 Request (clear a queue and insert track #12, then track #3): http://localhost:8000/command?password=123&command=queue&indexes=12,3 Response: {"result":1} Explanation: queue is now contains tracks 12 and 3 Request (insert track #45 into the queue at position 5): http://localhost:8000/command?password=123&command=queue&index=45&pos=5 Response: {"result":0,"err":"position is out of range"} Explanation: request failed because specified position is out of queue boundaries
Wiki: Configure_stations
Wiki: Home
Wiki: Playback_queue
Wiki: Run_the_app