JW FLV Player FLV Ruby on Rails Plugin
Ruby
Latest commit cea2025 Feb 4, 2009 Nazar Aziz silly bug
Permalink
Failed to load latest commit information.
assets
lib
tasks
MIT-LICENSE
README.textile
init.rb initial commit Feb 2, 2009
install.rb

README.textile

JW Flash Player ActionView Helper

What Is It?

jw-playr-hlpr is Rails plugin that presents an ActionView wrapper for rendering JW Player 4.3 using SWOObject

JW Player is a popular open source Media (FLV, MP4, MP3, AAC, JPG, PNG and GIF) player.

Getting Started

  1. Download and extract into vendor/plugins/jw-playr-hlpr
  2. rake jw_player:install to copy over player.swf and swfobject.js to public/swf and pubilc/javascript
  3. javascript_include_tag ‘swfobject’ in your application or page layout
  4. inside your view <%= player (:file => ‘/library/video.flv’, :image => ‘/library/splash.flv)’ %> where :file is the FLV video to play and optionally :image which will render a splash image. Note that both :file and :image are relative to your website’s public folder. So if public = /home/my/site/public then :file => ‘/library/video.flv’ will actually be in /home/my/site/public/library/video.flv. The same applies to :image.

More Info

The jw-playr-hlpr plugin adds the player(player_options, flash_options) function to all your views.

player_options is a hash that can contain the player’s flashvars variable. The minimum required is {:file => ‘/path/from/public_html/video.flv’).

flash_options is an optional hash to contain additional or override Adobe flash parameters.

The plugin defines the following default flash_options:


:player_id => ‘jw_player’,
:id => ‘flash_player’,
:allowfullscreen => ‘true’,
:allowscriptaccess => ‘true’,
:play => ‘true’,
:menu => ‘false’,
:quality => ‘autohigh’,
:scale => ‘default’,
:width => 400,
:height => 300,

To override the JW Player dimensions:

<%= player({:file => '/path/video.flv'},{:width => 640, :height => 480}) %>

Skins

I’ve added a selection of skins alongside this plugin:

Skins are copied to Rails.root/public/swf/skins and can be set either in the helper:

  <%= player(:file => '/my/file/flv', :skin => 'bluemetal') %>

Alternatively, a default skin can be specified globally by adding the following to your environment.rb:

  PSP::JwPlayerHelper::DEFAULT_SKIN = 'bluemetal'

The plugin assumes that all skin swf files will be stored in Rails.root/public/swf/skins. Any new skins can be placed in this folder.

Credits

This plugin is based on on Farooq Ali’s Flash Playr Hlpr excellent plugin

Farooq’s Player includes JW Player 3.x and ufo.js. JW Player has since been updated to 4.x to support tasty new features likes skins, plugins and modules.