Media Sources

How to use audio sources.

What are media sources

OpenAudioMc is a web-first platform, meaning that everything you give it as input has to be accessible over the internet. In this case, that means that your media sources need to come from a publicly available web-page or another supported platform.

This usually comes in the form of URL's you enter within your other audio related commands or API queries.

Supported platforms

We support a handful of methods to get your media to the client. These include:

  • SoundCloud
    1. SoundCloud media must be public (so no private uploads/accounts)
    2. Some artists may not allow their content to be used on third party sites, so playback will not work in these cases
    3. Although supported, this isn't advised for production use.
  • Your own Web Server
    1. Your Web Server must have a valid domain with an SSL certificate
    2. Your Web Server must support partial content, most big vendors support this natively when serving directly from the file system
    3. Compatible file-types depend on the browsers your players use. We recommend sticking with .mp3 or .m3u for live sources
    4. Try to keep individual file-sizes below 25Mb to ensure reliability
  • YouTube links (handled by a third party)
    1. YouTube links may not work the first time you use them, as they have to be pre-processed before playback is available. This can take a while depending on the content length. Please Try again later if it doesn't work initially.
    2. Content may not be longer than 60 minutes, but we recommend aiming for 15 minutes max.
    3. Although supported, this isn't advised for production use.

Random media and playlists

OpenAudioMc supports random media playback, which means that you can give it a list of media sources and pick one at random to play. These lists are treated as playlists when the media is set to loop (as is the case in regions, speakers, and when you manually set the flag). To do this, simply provide a JSON array in place of a single media source. For example:

["https://soundcloud.com/creide13/the-last-king-of-hyrule","https://soundcloud.com/creide13/a-kings-request-cutscene"]

Media Options

Media playback behaviour can be configured through Media Options. These can be used in some commands in the form of a JSON string, or as a MediaOptions object through the API.

It supports the following properties

  • fadeTime (Integer): Time for the sound to fade in (in MS)
  • id (String): A manual ID/reference to the newly started media. Can be used to stop/edit this media later on
  • loop Boolean: A boolean flag that indicates if this media should loop when it finished (true/false), default is false.
  • pickUp Boolean: A boolean flag that indicates if the client should attempt to synchronize with other listeners. Default is false.
  • expirationTimeout Integer: Media is normally only started for players who have their client open at the time the command is sent. With this timeout, you can make OpenAudioMc wait a given amount of time (in seconds), after which the media will still play for a client even if they connected a bit later.
  • volume Integer: The volume (from 0 to 100%) at which the media should be played. This is still relative to the users own volume slider. (Default value is 100)

    A full media flags object might look a little like this
{fadeTime:1500,id:"spawn",loop:true,pickup:true,expirationTimeout:3600000,volume:50}

Note that the JSON may never include spaces or line breaks.