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 —
Spacepauses 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
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 Links and the Resource's Address
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
| Option | Default | Description |
|---|---|---|
Config.music.tracks | 2 samples | The playlist |
Config.music.volume | 50 | Starting volume 0–100, until a player picks their own |
Config.music.fadeIn | 3 | Seconds the music takes to rise out of silence, 0–15 |
Config.music.startDelay | 1.2 | Seconds after the screen has come in before the player starts |
Config.music.shuffle | false | A different order on every join |
Config.music.showPlayer | true | The record button and player. Off still plays the music |
Config.music.nowPlaying | true | Name each new song in the bottom-right corner |
Config.music.playerLinks | true | Players may add their own songs |
Config.music.maxPlayerLinks | 20 | Most songs one player can add, 1–50 |
Config.music.playKey | 'Space' | Key that pauses and resumes. Empty turns it off |
Config.music.remember | true | Remember each player's volume, pause and songs |
See Music Settings for every option.
