Forum: Ruby on Rails how to play video in ruby on rails

Posted by honey jadala (honeyruby)
on 2011-12-28 11:57
(Received via mailing list)
hey everyone i want to add a video and play it using ruby on rails .
how can i do it. can anyone help me plzz..

Thanks in advance
Posted by Ralph Shnelvar (ralphshnelvar)
on 2011-12-28 16:31
(Received via mailing list)
hr> hey everyone i want to add a video and play it using ruby on rails .
hr> how can i do it. can anyone help me plzz..

hr> Thanks in advance

After struggling with this for several days, I have finally been able to 
get some videos to play in Rails 3.1.2.  There may be other ways of 
playing videos and if there are I'd sure like to hear about
it.

Here is some preliminary documentation.  I'm gonna write up more when I 
get all the kinks out.


The following instructions are for Rails 3.1.2

1) Download from here: 
http://rubydoc.info/gems/jw_player_helper/0.0.1/fi...


2) Add
     gem 'jw_player_helper'
   to your Gemfile


3) Do
     bundle install
   or
     bundle install --deployment
   depending on your needs.


4) Assuming that you are using sprockets (which seems to be the 
recommended default), make sure that swfobject.js is accessible from 
your assets.

   You can check if swfobject.js is accessible by displaying 
Rails.application.config.assets.paths.

   Rails.application.config.assets.paths is an array of fully qualified 
directory names where assets can be found.  Make sure that swfobject.js 
is in one of the directories and not in a subdirectory
   of one of these directories.


5) Place your video(s) in a directory underneath public.  I chose a 
directory named "videos".

   = video_player( {:file => 'videos/my_video.flv'}, {:width => '100%'} 
)



Let me know if you get videos to work and if this sketch of 
documentation needs to be beefed up.

Oh, this sketch is due to a frustrating 5 days of trying to get videos 
to play on 3.1.2.  I hope it takes you a lot less time.
Posted by Santosh Kumar Mohanty (Guest)
on 2011-12-29 08:31
(Received via mailing list)
Hey,

  According to my knowledge you can play the video url using a iframe or
using Y_tube gem...
Posted by honey jadala (honeyruby)
on 2011-12-29 09:02
(Received via mailing list)
i am using 2.3.8 rails and ruby 1.8.7 does it work in this version. is 
it
mandatory to have rails 3
Posted by Ben Eggett (Guest)
on 2011-12-29 09:18
(Received via mailing list)
Sorry to be harsh, but if you don't know how to code to play videos,
you probably ought to forget about RoR for a bit and start with
learning front-end coding and playback mechanisms. Once you have some
solid tools built up, you can then bring it back into RoR and use Ruby
to draw your video players and source files dynamically.

There are plenty of good places to start, depending on your needs:
 http://camendesign.com/code/video_for_everybody
http://sandbox.thewikies.com/vfe-generator/
http://flowplayer.org
http://videojs.com

or simply youtube.com - embedding videos.

You need to know the difference between front-end and back-end tools
(client side and server side). Realizing that RoR will ultimately
deliver front-end code to the user in some form or another
Posted by Hackeron (Guest)
on 2011-12-30 15:01
(Received via mailing list)
Some times it's nice to know if there is a defacto standard - the
current HTML5 generation of players are still pretty buggy.

The best I've used is mediaelementjs, there is a rails gem here:
https://github.com/tobsch/mediaelement_rails
Posted by Felipe Fontoura (Guest)
on 2011-12-30 16:46
(Received via mailing list)
Hello!

You can play easy with flash players. So isn't a ruby task, you can add 
in
view layer as html/js code.

[]'s

---
Felipe Fontoura
Eng. de Computao
http://www.felipefontoura.com


2011/12/28 honey ruby <emailtohoneyruby@gmail.com>
Posted by honey jadala (honeyruby)
on 2011-12-31 09:24
(Received via mailing list)
This playing a video is a new one for me so i am learning it. if u don't
know how play a video it does not mean you don't know ROR . New things 
has
to learned only by researching and in that process only i posted it.
Posted by Rishi J. (rishi_j)
on 2013-03-02 12:42
Hi Ralph Shnelvar

I followed your steps for using jw_player_helper. I got the jw player on 
my view but somehow it does not play any video. I have put up the video 
under public/videos .When click on play, it shows no-access or file not 
found at videos/3.mp4 . What I could be missing?
I am working on Rails 3.2.11
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.