user88
user88

Reputation: 1164

Play video in ruby on rails application

In y windows application, I am want to play video in my application using this link http://rubydoc.info/gems/jw_player_helper/0.0.1/file/README.markdown# . In the Rails 3 heading of this link.

The first two steps I have done, i.e below: but in the 3rd step, I don't understand what he says:

  1. add gem jw_player_helper into your Gemfile
  2. add <%= javascript_include_tag 'swfobject' %> in your html.rb
  3. now you can use <%= video_player(flashvars={}, attributes={}, params={}) %> to render JW Player

Can you help me figure out what to do?

Upvotes: 1

Views: 4467

Answers (3)

user88
user88

Reputation: 1164

Put video in public folder, and change this :file => "/video/water_msg.flv"

Upvotes: 0

cjnahine05
cjnahine05

Reputation: 203

I want to help you with this problem ..but maybe you need to change all to this.just flow all of these.OKAY ? Download jwplayer from http://www.longtailvideo.com/jw-player/download/

Put these files to the particular directory:-

app/assets/jwplayer/jwplayer.flash.swf

vendor/assets/javascripts/jwplayer.js

vendor/assets/javascripts/jwplayer.html5.js

Then add these line in application.js

//= require jwplayer
//= require jwplayer.html5

On the page where you are playing video, add these lines

<script type="text/javascript">jwplayer.key="YOUR_JWPLAYER_KEY";</script>
  <div id="video">Loading the player ...</div>
  <script type="text/javascript">
  jwplayer("video").setup({
  flashplayer: "<%=asset_path('jwplayer.flash.swf')%>",
  file: "<%= file_path %>",
  height: 360,
  width: 640,
  analytics: {
    enabled: false,
    cookies: false
  }
});
</script>

https://account.longtailvideo.com/#/account from where you can get your Self-Hosted Player License Key (YOUR_JWPLAYER_KEY) in signing up from Get Your License Key portion.

Take a look https://github.com/shamsulsham89/jwplayer-rails3.2

Please test it first on Chrome Version 30

Upvotes: 0

cjnahine05
cjnahine05

Reputation: 203

Example. hope it helps.

 <%= video_player({:file => "/video/pf2011.flv", :image => "/video/pf2011.jpg"}) %>

renders JW Player with splash screen pf2011.jpg

<%= video_player({:file => "/video/pf2011.flv", :image => "/video/pf2011.jpg"}, {:width => 640, :height => 480, :id => "pf2011_video"}) %>

renders JW Player with resolution 640x480px and id pf2011_video

<%= video_player({:file => "/video/pf2011.flv", :image => "/video/pf2011.jpg", :mute => true}, {:width => 640, :height => 480, :id => "pf2011_video", :onclick => "alert('clicked!');"}) %>

You will put this into your Html.rb so that your video post on your page..

Upvotes: 2

Related Questions