0

I am trying to embed a video inside my reagent (clojurescript) web app, and it doesn't seem to work

the following just doesn't produce a video on my localhost webpage -

[:video {:muted true :loop true :autoplay true :height "240px" :width "320px"}
 [:source {:type "video/mp4"
           :src "C:\\Users\\user\\testProject\\src\\main\\resources\\testVideo.mp4"}]]

just to clarify - the rest of the web app does seem to work

I am using the shadow-cljs compiler with [reagent "1.1.1"]

As sanity check I tried to embed the video inside a simple html page (no clojurescript), and it does seem to work for me, here is the html I use -

<video width="320px" height="240px" autoplay loop muted>
<source src="C:\Users\user\testProject\src\main\resources\testVideo.mp4" type="video/mp4">
</video>

is there something I am missing or doing wrong? would love to get some help on that

btw - I used this html to hiccup converter

Viktor Karsakov
  • 157
  • 3
  • 10
  • 1
    Did you try to move this file into `resources/public` directory of your project? (with only `testVideo.mp4` in src)? – Martin Půda Oct 17 '22 at 12:21
  • 1
    "does not seem to work" **what** does not work? Also have you checked your dev-console in the browser? the network-tab? – cfrick Oct 17 '22 at 12:44
  • @MartinPůda @cfrick it works now, thank you for the help! I opened the dev-console as you suggested and saw the error - `Not allowed to load local resource: file:///C:/Users/user/testProject/src/main/resources/testVideo.mp4` I tried to move it to my 'public' folder (btw for me it is not inside a `resource` directory - should it be?) and now the video appears in the browser as I wanted Thanks again! ps If either of you guys want to add an answer for future clojurians I would be more than happy to accept – Viktor Karsakov Oct 17 '22 at 14:06

0 Answers0