diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-06-05 01:47:27 +0200 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-06-05 01:47:27 +0200 |
commit | 4a5ee917fba2be13faff30c05d51f8dda80f2c73 (patch) | |
tree | e55424743dc7ae79314bc4e85a12a44f5629e831 /src | |
parent | 8cb2e4bf10e6d2fd3ce5d0ade22619394deacd65 (diff) |
fix: fix hiding background player after player disposal
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/tubo/player/events.cljs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/frontend/tubo/player/events.cljs b/src/frontend/tubo/player/events.cljs index e32b4aa..c9fca56 100644 --- a/src/frontend/tubo/player/events.cljs +++ b/src/frontend/tubo/player/events.cljs @@ -163,6 +163,13 @@ :mute {:player player :muted? value}})) (rf/reg-event-fx + :background-player/hide + [(rf/inject-cofx :store)] + (fn [{:keys [db store]} _] + {:db (assoc db :background-player/show false) + :store (assoc store :background-player/show false)})) + +(rf/reg-event-fx :player/loop [(rf/inject-cofx :store)] (fn [{:keys [db store]} _] @@ -180,13 +187,13 @@ (let [remove-entries (fn [elem] (-> elem - (assoc :background-player/show false) (assoc :queue []) (assoc :queue-pos 0)))] {:db (remove-entries db) :store (remove-entries store) :fx [[:dispatch [:background-player/pause true]] - [:dispatch [:background-player/seek 0]]]}))) + [:dispatch [:background-player/seek 0]] + [:dispatch [:background-player/hide]]]}))) (rf/reg-event-db :background-player/ready @@ -251,9 +258,9 @@ (fn [{:keys [db store player]} [_ idx play? res]] (let [stream-res (js->clj res :keywordize-keys true)] {:db (assoc db - :background-player/show (not (:main-player-show db)) + :background-player/show (not (:main-player/show db)) :background-player/loading false) - :store (assoc store :background-player/show (not (:main-player-show db))) + :store (assoc store :background-player/show (not (:main-player/show db))) :fx (apply conj [(when play? [:dispatch [:queue/change-stream stream-res idx]])] (when (and (:background-player/ready db) play?) [[:media-session-metadata |