Configuring Cast

The configuration file of Cast is written in JSON. Any edits have to be valid JSON or Cast will refuse to start.

Here is an example configuration file for Cast (which is working):

{
    "httpPort": 80,
    "httpsPort": 443,
    "httpsCert": "./cert",
    "httpsKey": "./key",
    "hostname": "http://92.222.84.155",
    "apikey":"MzthT2Pk9yVFu2FQJr3ueMeUi2YhF3",
    "trustProxy":false,

    "hls": false,
    "dash": false,

    "input": {
        "SHOUTcast": 8000
    },
    
    "directories":{
        "Icecast":[]
    },

    "streams": [{
        "stream": "128kbps",
        "password": "password",
        "titleOverride": "Guest DJ %s"
    }, {
        "stream": "relay",
        "relay": "http://curiosity.shoutca.st:8006/stream"
    }, {
        "stream": "live",
        "password": "live",
        "primary": true
    }]

}

🚧

Don't forget to change the passwords and API key

The default passwords and API key are the same for every copy of Cast and are publicly available. It would be a pretty bad idea to use them in production, so please do not forget to change them.

HTTP(S) server

You can configure which ports to use for HTTP and HTTPS. Setting the port to 0 will disable the corresponding server.

The hostname must include either http:// or https://, as this is used to determine the protocol to use in links.

API key

❗️

Don't forget to change the default API key

The API key grants access to private APIs and sensitive information, so you shouldn't use the default API key.

The API key can be of any length and will be used to access private APIs like the listeners details. Because the API key grants access to private APIs, it should be treated as a password.

Once the admin APIs of SHOUTcast and Icecast are implemented, Cast will use the API key as the “administrator password” (to use the SHOUTcast and Icecast glossary).

Input

The input option has to be a JSON object of the protocol as key and the port as value.

Currently, Cast only supports the SHOUTcast protocol as input. Please note that the SHOUTcast protocol needs both the specified port and the port + 1.

Directories

Directories are online lists of radio stations where people can browse stations per genre and tune in. While some directories like TuneIn require a manual registration, others like the SHOUTcast do not.

The directories option needs to be a JSON object with the type as key and an array of URLs as value.

Currently, Cast only supports “Icecast” directories as the SHOUTcast yp2 protocol is not allowed to be used for non-SHOUTcast servers. However, SHOUTcast.com lists many non-yp2 Icecast directories too.

Streams

Streams can be compared to Icecast's mount points. Each stream has a name and a unique password used for the encoder to tell which stream needs to be connected to.

At least one stream needs to have the property primary: true. The primary stream is shown as default on the status page and the SHOUTcast API will recognise that one as SID 1.

If you want to relay a stream from an Icecast/SHOUTcast server you can set relay to the URL of the stream.

titleOverride allow you to override the stream title. %s will be replaced with the encoder provided title.

HLS and DASH

Cast supports HLS and DASH streaming. This needs to explicitly be enabled in the configuration. To build the MP4 segments and TS files Cast uses FFMPEG, this needs to be installed on the system to be used.