Playerservices Endpoints¶
Warning
Deprecation notice
The old endpoint that start with https://playerservices.streamabc.net are deprecated and continue to work for a while but get no updates and are not high available anymore. Please migrate to the new endpoints mentioned below.
Polling¶
https://api.streamabc.net/metadata/channel/{channelkey}.json
(Channel JSON Polling)
https://api.streamabc.net/metadata/channel/{channelkey}.txt
(Channel TXT Polling)
https://api.streamabc.net/metadata/station/{stationkey}.json
(Station JSON Polling, metadata for all channels of this station)
https://api.streamabc.net/metadata/listener/{metaid}.json
(Listener JSON Polling, metadata a specific listener, please consider using Websockets here)
Websockets¶
wss://api.streamabc.net/metadata/listener/{metaid}
(Websockets Listener Metadaten)
wss://api.streamabc.net/metadata/channel/{channelkey}
(Websockets Channel Metadaten)
wss://api.streamabc.net/metadata/station/{stationkey}
(Websockets Station Metadaten)
To use the websockets endpoints you need to subscribe and listen for incoming JSON messages. There are PING messages that are sent to keep the connection alive and that have to be answered with PONG messages. The browser implementation of the websockets API usually does this automatically.
A simple Javascript browser example can be found here:
<pre id="now"></pre>
<pre id="next"></pre>
<pre id="status"></pre>
<script>
const now = document.getElementById("now");
const next = document.getElementById("next");
const status = document.getElementById("status");
const socket = new WebSocket("wss://api.streamabc.net/metadata/channel/qc_fkvwoo65bsvz_tuzx");
socket.onopen = function () {
status.innerHTML += "Status: Connected\n";
};
socket.onclose = function () {
status.innerHTML += "Status: Disconnected\n";
};
socket.onmessage = function (e) {
const metadata = JSON.parse(e.data);
console.log(metadata);
if (metadata.type === "next") {
next.innerHTML = "Es folgt: " + metadata.song + " von " + metadata.artist;
} else {
now.innerHTML = "Es läuft: " + metadata.song + " von " + metadata.artist;
}
};
</script>
Listener specific Metadata¶
In order to activate listener specific metadata you need to start a stream by providing a unique meta id
for each listener as query parameter metaid
as part of the stream url.
You than use the same meta id to either subscribe to the websocket or access the polling endpoint.
- GET https://api.streamabc.net/metadata/channel/(string: channelkey).json¶
Example request:
curl https://api.streamabc.net/metadata/channel/qc_fkvwoo65bsvz_tuzx.json
Example response:
{ "rawdata": "", "userplayout": false, "channel": "QuantumCast ShowCase Sequenz", "session": "", "position": "c9eb8216c09ccf4541edadee70178aa1", "marker": "", "id": "", "mount": "", "channelkey": "qc_fkvwoo65bsvz_tuzx", "timestamp": "2021-12-01T17:58:32Z", "artist": "Adele", "song": "Someone Like You", "station": "quantumcast", "start": "01.12.2021 17:58:32", "duration": 294, "start_timestamp": 1638381512, "type": "now", "etype": 1008 }
- Response JSON Object
time (time.Time) – ISO 8601 combined date-time format
start (string) – local date-time
start_timestamp (int64) – unix timestamp
duration (int) – Length of the audio item
song (string) – song name
artist (string) – artist name
code (string) – code
channelkey (string) – channelkey - unique key / ID of the stream
timezone (string) – time zone of the time specification
channel (string) – channelkey - unique key / ID of the stream
id (string) – reference ID
userplayout (bool) – default:
false
|true
in case of personalized audio streamseparator (string) – separator between artist and song, default is ” - “
etype (int) – Content-type ID of the audio item as an integer
type (string) – type of record
isrc (string) – ISRC of the audio item