Reputation: 2899
I have been trying for the past 2 hours to make HTML5 Video work. Could somebody show me what I am doing wrong? I have a home controller that has ONLY ONE action called index
which I use to render the home page (index.html.erb). My route file is:
TEST::Application.routes.draw do
get "home/index"
root :to => 'home#index'
..
..
My index.html.erb file has ONLY THIS LINES:
<div class="row"> <h3>TEST </h3> </div>
<div class="row">
<div class="span12">
<%= video_tag("test_video_1.ogg", :size => "320x240", :controls => true, :autobuffer => true) %>
</div>
</div>
I added this to my "config/application.rb" file:
# Enable the asset pipeline
config.assets.enabled = true
config.assets.paths << "#{Rails.root}/app/assets/videos"
The stupid video file is there. In "/app/assets/videos". I am using thin server. Now why the buck do I get this error?
Started GET "/videos/test_video_1.ogg" for 127.0.0.1 at 2012-10-01 13:13:00 +0100
ActionController::RoutingError (No route matches [GET] "/videos/test_video_1.ogg"):
Could somebody explain me what is happening?
Upvotes: 5
Views: 2070
Reputation: 1027
It seems video_tag
looks for stuff under your public folder so you have two options.
Put your video under public/videos and remove the extra path from the assets paths or manually write the video tag pointing to "assets/test_video_1.ogg". (Notice the lack of "videos" here)
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#method-i-video_tag
Upvotes: 3