diff options
-rw-r--r-- | src/frontend/tubo/player/events.cljs | 7 |
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 |