Media sources

A "Media Source" is a descriptor of where one or more media files are located. When a command or system calls for a "source" or "media source" input, it is expecting you to provide a valid media source like one of the ones described below.

Supported sources

OpenAudioMc has built in support for a variety of media sources, each with their own use-cases.

ServiceFormatUsecaseLimitations
Media uploaded into your OpenAudioMc accountFiles in your account should be prefixed with files:. For example, if I wanted to play beats.mp3 from my account, I would need to use files:beats.mp3Easiest to use and well integrated into the service, best suited for core playback and important files.Storage in your OpenAudioMc account is limited (200MB in the free tier, 10GB+ for patreons)
Public uploads to SoundCloud.comSoundcloud song links can be used directly like this example.For quick & free uploads, great when taking requests or letting users provide their own media.SoundCloud artists can choose whether their music is allowed on third party apps. This is why some major artists/record labels won't be playable through OpenAudioMc.
Music from your own webserver/CDNMust be a full web url, e.g. https://mydomain.com/folder/file.mp3Using your own CDN gives flexibility, removes storage constraints, and gives you direct control of your media.Your CDN does need to meet a few specific requirements to work nicely (please see the list below)
OpenAudioMc PlaylistsMust be prefixed by list:, directly followed by the ID/name of your playlist (e.g. list:spawn_musicUse playlists when you want to randomly pick from a list of sources to create variants, or chain multiple songs togetherOpenAudioMc playlists still need other sources inside them. Please check the Playlist Documentation for a full guide.
OpenAudioMc AliasAn alias is a shortcut to another media source. They are always prefixed with a:, followed by their name. E.g. a:spawn_songAn alias is great for media sources with a long file name or URL, that you can't remember easily. Please check the alias docs for details

Random media and Playlists

You might want to shake things up a little every once in a while by assigning random sounds to a region, command or whatever. You can simply do this by stringing multiple sources in a JSON array, so you'd enter something like ["https://www.youtube.com/watch?v=Oddp32TODKs","https://www.youtube.com/watch?v=QBCLsnxNd4Y"] instead of your singular source. The client will choose a random sound from the list when the media is requested to start. Randomized media with looping tags will reselect their source every time they loop, functioning like a playlist.

Requirements for selfhosted media

If you are hosting your own media files on your own webserver or CDN, there are a few requirements to ensure compatibility with OpenAudioMc:

  • CORS headers: Your server must provide appropriate CORS headers to allow cross-origin requests from OpenAudioMc clients. At minimum, the Access-Control-Allow-Origin header should be set to * or to the specific domains used by OpenAudioMc.
  • Supported formats: OpenAudioMc primarily supports common audio formats such as MP3 and OGG. Ensure your media files are in a compatible format.
  • Direct file access: The URLs provided must point directly to the audio files and not to HTML pages or redirects.
  • Stable hosting: Ensure that your server or CDN is reliable and can handle the expected traffic, especially during peak usage times.
  • HTTPS: It is recommended to serve your media files over HTTPS to ensure secure connections and compatibility with modern browsers.
  • Bandwidth considerations: Be aware of the bandwidth usage that may result from streaming audio files to multiple users simultaneously.
  • File size limits: Try limiting yourself to files under 50MB to ensure smooth playback on lower-spec clients.
  • Partial content support: Your server should support HTTP Range requests to allow for efficient streaming and seeking within audio files. You may need to enable this manually depending on your server software.

Javadoc related to this feature (currently based on the dev branch)