aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-01-30 23:14:08 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-01-30 23:14:08 +0100
commitac366404935cea6c179c5ea19fb12922a2e2398a (patch)
tree6955ceee0e3c1503f10fd19878db31b4c5154788
parent7ebe45c57980627ec7fd347f4735d382cfa88b3a (diff)
fix(frontend): set player on ended only on mount
-rw-r--r--src/frontend/tubo/components/audio_player.cljs4
1 files changed, 2 insertions, 2 deletions
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])}]))})))