This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-15
Channels
- # arachne (6)
- # aws-lambda (3)
- # beginners (14)
- # boot (56)
- # cider (8)
- # cljs-dev (5)
- # cljsrn (11)
- # clojure (240)
- # clojure-dusseldorf (3)
- # clojure-greece (165)
- # clojure-italy (5)
- # clojure-romania (1)
- # clojure-russia (24)
- # clojure-uk (30)
- # clojure-ukraine (3)
- # clojurescript (29)
- # core-async (6)
- # css (1)
- # cursive (25)
- # datascript (6)
- # datomic (61)
- # dirac (1)
- # events (3)
- # hoplon (1)
- # instaparse (3)
- # jobs (4)
- # juxt (28)
- # lein-figwheel (7)
- # leiningen (19)
- # luminus (1)
- # lumo (2)
- # nyc (1)
- # off-topic (19)
- # om (25)
- # onyx (4)
- # parinfer (2)
- # pedestal (23)
- # perun (20)
- # re-frame (44)
- # reagent (20)
- # remote-jobs (3)
- # ring (3)
- # ring-swagger (5)
- # rum (12)
- # slack-help (3)
- # spacemacs (25)
- # specter (62)
- # sql (16)
- # unrepl (313)
- # yada (4)
@misha that code you shared worked perfectly. It's actually more than I needed haha. Thanks heaps.
This is more like the code I am trying to do. But this in it's current form doesn't work. I'm putting it down to me not understanding :init
(rum/defcs video
< {:init
(fn [state _]
(let [video (atom nil)]
#?(:cljs (gob/set @video "playbackRate" 0.6))
(assoc state
:video video)))}
[state]
(let [set-ref! (:video state)]
[:div {:class ["full-width"
(css {:height 0})]}
[:div.inside-block
[:div
[:video#my-video.video {:auto-play "autoplay"
:loop "loop"
:muted true
:width "300"
:height "150"
:ref set-ref!
:controls true}
[:source {:src "media/demo.mp4"
:type "video/mp4"}]
[:source {:src "media/demo.webm"
:type "video/webm"}]]]]]))
What I'm doing is rendering everything statically serverside and then turning it into a SPA client side. Which is why I have the :cljs
conditional in there. I'm simply trying to set the playbackRate o a background video. In hindsight this is probably best done in a video editor because it seems the complications around doing it in code is more time consuming 😛
I'm not quite sure what you mean when you say from nil to node. Is that inside the (when-let [node @video] ...
??
so I would do something like :ref (set-ref! 0.6)
no that wouldn't work xD
Is there a way to set the initial state of a rum/local atom via an incoming prop/rum arg?