Search code examples
ruby-on-railsruby-on-rails-3htmlruby-on-rails-3.1

Html5 video with ruby on rails


I am just curious on how to display a video into a simple webpage using rails. I have try the following

<%= video_tag("video/trailer_test.mp4", :code:size => "320x240", :controls => true, :autobuffer => true)

But it didn't seem to do the trick. My file is located under public/video/trailer_test.mp4 but it won't work is there any reason why it shouldn't work? Note i only have an mp4 file at the moment.

This is the html created

<video controls="controls" height="240" width="320"><source src="video/trailer_test.mp4" /></video>

This is my path file

/home/jean/rail/map/public/video

and this is this is the name of my file

trailer_test.mp4

Solution

  • I have faced a similar problem few months ago. Try to give the path for the video between brackets - []:

    <%= video_tag(["video/trailer_test.mp4"], :size => "320x240", :controls => true) %>