Skip to main content

Music Player

A playlist of song links or audio files, a player with a waveform seek bar, and songs players add themselves.

This section

Music Player

Music fades in as the background opens and plays through the whole load. A record button in the menu opens the player.

Features​

  • Playlist of online song links or your own audio files (MP3 / OGG under ui/media/music/), in order or shuffled
  • Each song can start from a chosen second
  • Title, artist and cover are filled in automatically — from the link itself, or from the file's own tags — and can be set by hand
  • Waveform seek bar that moves with the music, plus play/pause, previous/next, volume and mute
  • "Now playing" note in the bottom-right corner whenever a new song starts
  • Player songs — players can paste their own song links into the player; they stay on that player's own computer
  • Remembered — each player's volume, mute, pause and added songs come back on their next join; a player who paused the music finds it paused until they play it again
  • Play key — Space pauses and resumes the music once the screen is up (configurable)
  • A song that cannot be played is skipped automatically, and named in the F8 console with the reason

Adding Songs​

lua
Config.music = {
tracks = {
{ source = 'https://your-song-link' },
{ source = 'media/music/song.mp3', title = 'Name', artist = 'Who', cover = 'media/cover.jpg', start = 12 },
},
}

title, artist, cover and start are optional. An empty list means no music and no player.

Online song links are played from this resource's own web address on your server (http://<your server>:30120/code9_loading/). Nothing needs setting up on almost every server — the screen uses the address the player connected to.

Only if your server answers web requests somewhere else (behind a proxy, on another name or port), set Config.game.httpBase, e.g. 'https://play.yourserver.com'. Songs from audio files never need this.

Configuration​

OptionDefaultDescription
Config.music.tracks2 samplesThe playlist
Config.music.volume50Starting volume 0–100, until a player picks their own
Config.music.fadeIn3Seconds the music takes to rise out of silence, 0–15
Config.music.startDelay1.2Seconds after the screen has come in before the player starts
Config.music.shufflefalseA different order on every join
Config.music.showPlayertrueThe record button and player. Off still plays the music
Config.music.nowPlayingtrueName each new song in the bottom-right corner
Config.music.playerLinkstruePlayers may add their own songs
Config.music.maxPlayerLinks20Most songs one player can add, 1–50
Config.music.playKey'Space'Key that pauses and resumes. Empty turns it off
Config.music.remembertrueRemember each player's volume, pause and songs

See Music Settings for every option.