0.01
No commit activity in last 3 years
No release in over 3 years
Simple Rails JWPlayer helper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

JW Player Helper

Simple Rails helper for rendering JWPlayer 5.4 using SWFObject v2.2

JW Player

Is opensource player supporting video (for example .mp4, .mov, .f4v, .flv), audio (.mp3) and image (.jpg, .png, .gif) files (full list).

Usage

Installation

Rails 3

  • add gem 'jw_player_helper' into your Gemfile
  • add <%= javascript_include_tag 'swfobject' %> in your layout
  • now you can use <%= video_player(flashvars={}, attributes={}, params={}) %> to render JW Player

Rails 2

  • add config.gem "jw_player_helper" into your config/environment.rb
  • add <%= javascript_include_tag 'swfobject' %> in your layout
  • now you can use <%= video_player(flashvars={}, attributes={}, params={}) %> to render JW Player

Configuration

flashvars

:file => "relative path to file (for example: /video/pf2011.flv)",
:image => "relative path to splash image (for example: /video/pf2011.jpg)",
:bufferlength => 1,
:autostart => false

Full list of JW Player flashvars

attributes

:id => 'jw_player',
:name => 'jw_player',
:width => 300,
:height => 300,
:message => "Get the Adobe Flash Player to see this video.",
:element => "div",
:onmouseover => nil, # you can define javascript callbacks for element
:onmouseout => nil,
:onclick => nil

params

:allowfullscreen => true,
:allowscriptaccess => 'always'

examples

<%= 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!');"}) %>

renders muted JW player with javascript alert when user click on video

skins

Gem is packed with few skins

  • glow

  • beelden

  • stormtrooper

  • simple

      Usage: add :skin => 'name' to your flashvars. For example: <%= video_player({:file => "/video/pf2011.flv", :image => "/video/pf2011.jpg", :skin => "glow"}) %>
    

You can find more skins here.

Usage: Copy downloaded zip into RAILS_ROOT/public/swf/skins and set :skin => 'name without .zip extension' flashvar