aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-01-29 21:48:36 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-01-29 21:48:36 +0100
commit7ebe45c57980627ec7fd347f4735d382cfa88b3a (patch)
tree53cb31a191fda3eb0e2e1774481f5bc5001dadb4 /src/frontend
parent264755a595b8166e344c7945d053e87ed6faeba3 (diff)
feat(frontend): amend playback for first stream after reload
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/tubo/components/audio_player.cljs6
-rw-r--r--src/frontend/tubo/events.cljs1
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)