1

I am developing a web-app that will stream a database of videos, but I am having difficulties with Webbrick and HTML5 Video. I am using a simple HTML tag but the video won't seem to show up. any help ? (the file path is correct btw).

Here is my HTML Code:

<div id="lr_video">

<%= video_tag (["videos/final_video.mp4", "final_video.ogg", "movie.webm"], :size => "320x240", :controls => true, :autobuffer => true) %>

</div>

my Ruby code:

in config/application.rb:

...
..
    #HTML5 Video !!!
    config.assets.paths << "#{Rails.root}/public/assets/videos"

..
...

now I am using Webrick as a production server, and I put my videos under "/public/assets/videos" but the video doesn't show up

any help ?

Test Test
  • 2,831
  • 8
  • 44
  • 64
  • try <%= video_tag (["assets/final_video.mp4", "final_video.ogg", "movie.webm"], :size => "320x240", :controls => true, :autobuffer => true) %> – lesce Feb 05 '12 at 17:33
  • try <%= video_tag (["final_video.mp4", "final_video.ogg", "movie.webm"], :size => "320x240", :controls => true, :autobuffer => true) %> – lesce Feb 06 '12 at 10:53

1 Answers1

1

You are probably sending the video with the wrong Content-Type header.

Check the output of

curl -I http://localhost:3000/assets/final_video.mp4 | grep Content-Type

It should say

Content-Type: video/mp4

If if does not, then you should fix the generation of the content-type header.

gioele
  • 9,748
  • 5
  • 55
  • 80
  • You need to adapt that line to your setup up; something like `curl -I http://devserver:8012/TheSite/videos/final_video.mp4'. – gioele Feb 07 '12 at 11:12
  • ok I tried this,'curl -I http://0.0.0.0:3000/public/assets/videos/final_video.mp4' and webrick returns me this: 'ActionController::RoutingError (No route matches [GET] "/public/assets/videos/final_video.mp4"):' how can this happen since I defined it above? – Test Test Feb 07 '12 at 11:36
  • The URI path is either `/assets/final_video.mp4` or `/assets/videos/final_video.mp4`, not `/public/videos/...`. So try `http://0.0.0.0:3000/assets/final_video.mp4`. – gioele Feb 07 '12 at 11:42
  • great, I now got, 'Content-Type: video/mp4', but the video won't show again. – Test Test Feb 07 '12 at 11:54
  • Can you make sure that the ` – gioele Feb 07 '12 at 12:42
  • BTW, if you are testing with MP4 files only, make also sure to use a browser that includes codec for such format, Safari in other words. – gioele Feb 07 '12 at 22:43
  • 2
    Any progress on this? Have the exact same problem, tried everything, no luck :( – Ain Tohvri Dec 03 '14 at 12:11