Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time


This library provides methods to receive realtime metadata for:

  • the listener that is connected to our infrastructure
  • a specific radio station channel
  • a specific radio station with all belonging channels

The SDK tries to use websockets to provide the best experience with realtime events. If no websocket connection can be established it falls back to polling. Due to limitations of this mode events are not real-time and not all features are available.

Note: Listener specific meta data is only available if the channel streamed on streamABC infrastructure. All other types can be used with all backed distributors.


Add a reference to our library to your web application like so:

<script src="//"></script>

Please load this library with a direct link and don't save local copy to your site. This prevents cross-domain issues makes sure you use the latest version.


Create an instance of sABC.Playerservices with calling sABC.newPlayerservices(options?: PlayerservicesConfig) somewhere in your code:

var sabcService = sABC.newPlayerservices({
    debug: false,
    apikey: "abc"

The function argument is a object with config values:

config key type default value description
debug boolean false enables debug output in browser console
apikey string api key provided by streamABC

After you created your instance you can attach event listeners to receive metadata events and start/stop receiving data.

Attach Event Listeners

sABC.Playerservices emits the following event types:

name arguments description
metadata JSON object with meta data fires if new meta data for current song is available
metanext JSON object with meta data fires if new meta data for next song is available
error error fires if an error ocurred, the response object property type defines if the error is on the websocket side (ws) or audio side (audio)

You can listen to one or both events:

sabcService.on("metadata", function(data) {

sabcService.on("metanext", function(data) {

The payload data of both events contains all available metadata, for example:

    "mount": "/sABCTest-sabcfm-mp3-256-5131639",
    "channel": "sABC-live", 
    "timestamp": "2017-07-12T16:28:13.452Z", 
    "session": "1cf9dc2a-530b-48a1-9979-f1ed1bcc719a",
    "rawdata": "LCD Soundsystem - New York, I Love You but You're Bringing Me Down",
    "artist": "LCD Soundsystem", 
    "song": "New York, I Love You but You're Bringing Me Down", 
    "type": "now",
    "meta": [
            "ASIN": "B001QC8V4I",
            "artist": "LCD Soundsystem",
            "image": "",
            "largeimage": "",
            "trackurl": "",
            "type": "amazon"
            "artist": "LCD Soundsystem",
            "artisturl": "",
            "image": "",
            "largeimage": "",
            "trackurl": "",
            "previewurl": "",
            "trackurl": "",
            "type": "itunes"

Start receiving user specific meta data

To receive listener specific meta data the first step is to decorate the streaming url with our listener parameter. There is a convinience utility method decorateStreamURL(url: string): string that does exactly this:

var streamURL = sabcService.decorateStreamURL("");

You can then start receiving meta data events:

var streamURL = sabcService.startMeta();

Note: The stream has to be played using the decorated stream URL to receive meta data events.

Start receiving channel or station events

Because meta data is not user specific in this mode, you don't need to decorate your stream URL.

You can start receiving events with one of this methods:

  • startMetaStation(station: string): void - receive meta data for all channels of a station
  • startMetaChannel(channel: string): void - receive meta data for one channel

Please use the channel key or station key provided by streamABC. You can find this information in your streamABC management console.


Stop receiving events and error handling

To stop receive meta data events you can use stopMeta() method. It doesn't matter what mode you use.

The SDK tries to handle connection errors as good as possible and reconnects if a websocket connection is lost.

Error events are emitted if the SDK detects a connection error. A detailed error message is provided as an argument to this event.

Be aware, that error events are emitted even though the SDK tries to get around it by itself, e.g. falling back to polling if websockets don't work.