diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/tubo/components/audio_player.cljs | 6 | ||||
-rw-r--r-- | src/frontend/tubo/events.cljs | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/frontend/tubo/components/audio_player.cljs b/src/frontend/tubo/components/audio_player.cljs index e8541a9..73cabea 100644 --- a/src/frontend/tubo/components/audio_player.cljs +++ b/src/frontend/tubo/components/audio_player.cljs @@ -12,7 +12,8 @@ (defn audio-source [!player] - (let [{:keys [stream]} @(rf/subscribe [:media-queue-stream])] + (let [{:keys [stream]} @(rf/subscribe [:media-queue-stream]) + media-queue-pos @(rf/subscribe [:media-queue-pos])] (r/create-class {:display-name "AudioPlayer" :component-did-mount @@ -29,8 +30,9 @@ [:audio {:ref #(reset! !player %) :loop (= loop-playback :stream) - :on-loaded-data #(rf/dispatch [::events/player-start]) :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])}]))}))) diff --git a/src/frontend/tubo/events.cljs b/src/frontend/tubo/events.cljs index a7d5269..f960baf 100644 --- a/src/frontend/tubo/events.cljs +++ b/src/frontend/tubo/events.cljs @@ -25,6 +25,7 @@ :stream {} :search-results [] :services [] + :paused true :loop-playback (if (nil? loop-playback) :playlist loop-playback) :media-queue (if (nil? media-queue) [] media-queue) :media-queue-pos (if (nil? media-queue-pos) 0 media-queue-pos) |