From 976e834a34e2c1641545f60a592f2ca2bed56509 Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Thu, 1 Feb 2024 21:43:56 +0100 Subject: feat(frontend): clean up audio player mount events --- src/frontend/tubo/components/audio_player.cljs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/frontend/tubo/components/audio_player.cljs b/src/frontend/tubo/components/audio_player.cljs index b8a0e57..40f05b1 100644 --- a/src/frontend/tubo/components/audio_player.cljs +++ b/src/frontend/tubo/components/audio_player.cljs @@ -18,9 +18,10 @@ {:display-name "AudioPlayer" :component-did-mount (fn [this] + (set! (.-onended (rdom/dom-node this)) + #(rf/dispatch [::events/change-media-queue-pos (+ media-queue-pos 1)])) (when stream - (set! (.-src (rdom/dom-node this)) stream) - (set! (.-onended @!player) #(rf/dispatch [::events/change-media-queue-pos (+ media-queue-pos 1)])))) + (set! (.-src (rdom/dom-node this)) stream))) :reagent-render (fn [!player] (let [!elapsed-time @(rf/subscribe [:elapsed-time]) -- cgit v1.2.3