From ac366404935cea6c179c5ea19fb12922a2e2398a Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Tue, 30 Jan 2024 23:14:08 +0100 Subject: fix(frontend): set player on ended only on mount --- src/frontend/tubo/components/audio_player.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/frontend') diff --git a/src/frontend/tubo/components/audio_player.cljs b/src/frontend/tubo/components/audio_player.cljs index 73cabea..b8a0e57 100644 --- a/src/frontend/tubo/components/audio_player.cljs +++ b/src/frontend/tubo/components/audio_player.cljs @@ -19,7 +19,8 @@ :component-did-mount (fn [this] (when stream - (set! (.-src (rdom/dom-node this)) stream))) + (set! (.-src (rdom/dom-node this)) stream) + (set! (.-onended @!player) #(rf/dispatch [::events/change-media-queue-pos (+ media-queue-pos 1)])))) :reagent-render (fn [!player] (let [!elapsed-time @(rf/subscribe [:elapsed-time]) @@ -32,7 +33,6 @@ :loop (= loop-playback :stream) :muted muted? :on-loaded-data #(rf/dispatch [::events/player-start]) - :on-ended #(rf/dispatch [::events/change-media-queue-pos (+ media-queue-pos 1)]) :on-time-update #(reset! !elapsed-time (.-currentTime @!player)) :on-pause #(rf/dispatch [::events/change-player-paused true]) :on-play #(rf/dispatch [::events/change-player-paused false])}]))}))) -- cgit v1.2.3