David Adafia
David Adafia

Reputation: 219

HTML5 VIDEO TAG NOT WORKING IN RAILS

So I used the HTML video code <video controls="controls"><source src="/assests/videos/HeatherBeem.mp4"/>Your browser does not support the video tag.</video>. It shows the video template but doesn't link to the video file in app/assets/videos.

This is the code in my activeadmin page

This is what it looks like in the browser

The first image is my HTML code with the video tag highlighted in activeadmin. The second image is how it looks like on the browser. It shows the video template without the video. I suspect it's not linking to the video tag. Is something wrong with the code??

I also double checked the - the video file is in app/assets/video/HeatherBeem.mp4

Would love some help. Thanks

Upvotes: 1

Views: 2810

Answers (3)

David Adafia
David Adafia

Reputation: 219

Okay guys I found the problem. I added config.assets.compile = true and config.serve_static_files = true to my development.rb file in config/env/dev.rb and then i run $ RAILS_ENV=development bundle exec rake assets:precompile and it worked.

I tried all the suggestions you gave and they worked perfectly once those two were in the development.rb. the config.serve_static_files = trueserves all assets in the public/assets folder. Thanks guys. You're awesome.

Upvotes: 1

fedesc
fedesc

Reputation: 2610

if you're link is with Rails convention and no naming was made to the pipeline

the problem you is a typo.

it's assets... not assests

than you can make sure you are pointing to the right end point

Upvotes: 0

Rob
Rob

Reputation: 2323

I got it working on my project by setting the source url without the folder "/videos" as shown below:

<video controls="controls">
  <source src="assets/video.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

Upvotes: 0

Related Questions