aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-12-02 00:49:19 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-12-02 00:49:19 +0100
commit7b59425029ebcb209e07663ab7da1cedf1912661 (patch)
tree0f91b01f919dcbed12b156ee687b61e3f4eaeda8 /src/frontend
parentd4c9e4947d794dd6cfc79199fffd85592515b6b3 (diff)
feat: add guard for player on source change
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/tubo/player/events.cljs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/frontend/tubo/player/events.cljs b/src/frontend/tubo/player/events.cljs
index 6350029..d189e56 100644
--- a/src/frontend/tubo/player/events.cljs
+++ b/src/frontend/tubo/player/events.cljs
@@ -18,9 +18,10 @@
(rf/reg-fx
:player/src
(fn [{:keys [player src current-pos]}]
- (set! (.-src @player) (clj->js src))
- (set! (.-onended @player)
- #(rf/dispatch [:queue/change-pos (inc current-pos)]))))
+ (when (and player @player)
+ (set! (.-src @player) (clj->js src))
+ (set! (.-onended @player)
+ #(rf/dispatch [:queue/change-pos (inc current-pos)])))))
(rf/reg-fx
:player/loop