diff options
Diffstat (limited to 'src/frontend')
-rw-r--r-- | src/frontend/tubo/player/events.cljs | 8 | ||||
-rw-r--r-- | src/frontend/tubo/player/views.cljs | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/frontend/tubo/player/events.cljs b/src/frontend/tubo/player/events.cljs index c7d1a1c..70bb0cc 100644 --- a/src/frontend/tubo/player/events.cljs +++ b/src/frontend/tubo/player/events.cljs @@ -88,11 +88,15 @@ (set! (.. (.$ (.getChild ^videojs/VideoJsPlayer @player "ControlBar") class) -style -background) color)))) (rf/reg-event-fx + :player/set-slider-color + (fn [_ [_ !player service-id]] + {:slider-color {:player !player :color (utils/get-service-color service-id)}})) + +(rf/reg-event-fx :player/start-in-main [(rf/inject-cofx ::inject/sub [:elapsed-time])] (fn [{:keys [db]} [_ !player options service-id]] - {:fx [[:audio-poster-mode {:player !player :options options}] - [:slider-color {:player !player :color (utils/get-service-color service-id)}]]})) + {:fx [[:audio-poster-mode {:player !player :options options}]]})) (rf/reg-fx :media-session-metadata diff --git a/src/frontend/tubo/player/views.cljs b/src/frontend/tubo/player/views.cljs index 9196348..d7b851d 100644 --- a/src/frontend/tubo/player/views.cljs +++ b/src/frontend/tubo/player/views.cljs @@ -176,7 +176,9 @@ (fn [^videojs/VideoJsPlayer this] (VideojsQualitySelector videojs) (reset! !player (videojs (rdom/dom-node this) (clj->js options))) - (.on @!player "ready" #(.mobileUi ^videojs/VideoJsPlayer @!player)) - (.on @!player "play" #(rf/dispatch [:player/start-in-main !player options service-id]))) + (.on @!player "ready" (fn [] + (.mobileUi ^videojs/VideoJsPlayer @!player) + (rf/dispatch [:player/set-slider-color !player service-id]))) + (.on @!player "play" #(rf/dispatch [:player/start-in-main !player options]))) :component-will-unmount #(when @!player (.dispose @!player)) :reagent-render (fn [options] [:video-js.vjs-tubo])}))) |