const timeBeforeLastSongs = 60 * 1000; // 1 Minute const dropTimeForLastSong = 5 * 1000; // 5 sec export default { name: 'countdown', components: { Galaxy, ScoreList, Timer }, // ... methods: { /// ... timeUpdate(event) { // If we're in the last song delay, we first drop the sound of current sound before if ( event.diff < timeBeforeLastSongs && event.diff > timeBeforeLastSongs - dropTimeForLastSong ) { // We simulate a kind of fader to switch to last song const adjustDiff = event.diff - (timeBeforeLastSongs - dropTimeForLastSong); this.audioPlayer.manageVolumeFromPercent( adjustDiff / dropTimeForLastSong, ); } else if (event.diff < timeBeforeLastSongs && !this.switchToLastsSongs) { // When it's time, we switch to last song this.audioPlayer.switchToLastsSongPlaylist(); this.switchToLastsSongs = true; } else if (this.audioPlayer) { // We wait for the last 10 seconds to drop down the volume this.audioPlayer.manageSoundVolume(event.diff); } }, // ... }, // ... };