Rails Play video

343 views
Skip to first unread message

Maddy

unread,
Jan 31, 2013, 7:31:48 AM1/31/13
to rubyonra...@googlegroups.com
Hi Folks,

I want play videos, the src file should i get from assets/videos.

I just created one folder in my assets like videos and placed one .mov file.

In my view,

<video width="320" height="240" controls="controls">
  <source src="/assets/videos/demo.mov" type="video/mov" />
   Your browser does not support the video tag.
</video>

But its not working. Please advice.

Walter Lee Davis

unread,
Jan 31, 2013, 12:02:58 PM1/31/13
to rubyonra...@googlegroups.com
I don't think you use the assets part of the path in Rails 3.1+. Try it with just /videos/video.mov and see what happens then.

Walter
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/TygyXNbguhoJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

tamouse mailing lists

unread,
Feb 1, 2013, 10:48:31 PM2/1/13
to rubyonra...@googlegroups.com
On Thu, Jan 31, 2013 at 11:02 AM, Walter Lee Davis <wa...@wdstudio.com> wrote:
> I don't think you use the assets part of the path in Rails 3.1+. Try it with just /videos/video.mov and see what happens then.
>
> Walter
>
> On Jan 31, 2013, at 7:31 AM, Maddy wrote:
>
>> Hi Folks,
>>
>> I want play videos, the src file should i get from assets/videos.
>>
>> I just created one folder in my assets like videos and placed one .mov file.
>>
>> In my view,
>>
>> <video width="320" height="240" controls="controls">
>> <source src="/assets/videos/demo.mov" type="video/mov" />
>> Your browser does not support the video tag.
>> </video>
>>
>> But its not working. Please advice.

Using the HTML you have above, you'd need to house the movie under
#{Rails.root}/public somewhere, rather than #{Rails.root}/app/assets,
probably something like:

#{Rails.root}/
public/
videos/
demo.mov


Then, your source tag should use:

src="/videos/demo.mov"

I would definitly keep such large things out of the asset pipeline, as
it would bog down assets:precompile a lot.

It's also something I'd definitely not want in my repository with my
code; I'd have some other way of versioning/deploying it.
Reply all
Reply to author
Forward
0 new messages