diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-12-10 11:13:43 +0100 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-12-10 11:13:43 +0100 |
commit | f7d823cd3455aa73a17c927382ea3f34f4610c23 (patch) | |
tree | 708f874c83b749ea63c9d292dea63c2371140297 /src | |
parent | 1de16fe0f77d1cee7eb521486fc1d71aef2d3a36 (diff) |
feat: add muted attribute to audio player and fix seek
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/tubo/bg_player/events.cljs | 5 | ||||
-rw-r--r-- | src/frontend/tubo/bg_player/views.cljs | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/frontend/tubo/bg_player/events.cljs b/src/frontend/tubo/bg_player/events.cljs index c82b50e..39b12d9 100644 --- a/src/frontend/tubo/bg_player/events.cljs +++ b/src/frontend/tubo/bg_player/events.cljs @@ -6,9 +6,8 @@ (rf/reg-event-fx :bg-player/seek [(rf/inject-cofx ::inject/sub [:bg-player])] - (fn [{:keys [db bg-player]} [_ time]] - (when (:bg-player/ready db) - {:player/time {:time time :player bg-player}}))) + (fn [{:keys [bg-player]} [_ time]] + {:player/time {:time time :player bg-player}})) (rf/reg-event-db :bg-player/set-paused diff --git a/src/frontend/tubo/bg_player/views.cljs b/src/frontend/tubo/bg_player/views.cljs index d554ce3..a7e511b 100644 --- a/src/frontend/tubo/bg_player/views.cljs +++ b/src/frontend/tubo/bg_player/views.cljs @@ -271,12 +271,16 @@ #(rf/dispatch [:queue/change-pos (inc queue-pos)])) (when stream (set! (.-src (rdom/dom-node this)) - (:content (nth (:audio-streams stream) 0))))) + (-> stream + :audio-streams + first + :content)))) :reagent-render (fn [!player] [:audio {:ref #(reset! !player %) :loop (= @(rf/subscribe [:player/loop]) :stream) + :muted @(rf/subscribe [:player/muted]) :on-can-play #(rf/dispatch [:bg-player/ready true]) :on-seeked #(reset! !elapsed-time (.-currentTime @!player)) :on-time-update #(reset! !elapsed-time (.-currentTime @!player)) |