From 3613fb68c2e3f7c4a50614ff1224dc6e794ecd32 Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Sun, 1 Sep 2024 15:42:15 -0400 Subject: [PATCH] play next song --- app/javascript/controllers/audio_player_controller.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/javascript/controllers/audio_player_controller.js b/app/javascript/controllers/audio_player_controller.js index fcb06b3..10b6b1a 100644 --- a/app/javascript/controllers/audio_player_controller.js +++ b/app/javascript/controllers/audio_player_controller.js @@ -43,6 +43,9 @@ export default class extends Controller { // Initialize halfway tracking this.hasHalfwayEventFired = false; + + // Listen for the 'ended' event to play the next song + this.audio.addEventListener("ended", this.nextSong.bind(this)); } autoPlay() {