Jun12010

Flash Player Helper [Plugin for Rails]

What Is It?

Flash player Helper is a Rails plugin that presents an ActionView wrapper for rendering JW Flash Player 5.1 and Image Rotator

JW Flash Player is a popular open source Media player that supports most media formats. This Plugin is also backward compatible for version lesser than 5.1.

To use it you need to install plugin by running

1
script/plugin install git://github.com/bagwanpankaj/flash_player_helper.git

This will automatically setup JW Flash Player for your rails application. It also installs required files under public folder.

If required files are not copied autometically under public directory then you can copy them by running

1
rake flash_player:install

How to use

Include swfobject javascript into layout or view file

1
<%= javascript_include_tag 'swfobject' %>

Now to use flash player

1
<%= player() %>

See here, no parameter are passed, so it works with all default parameters. only file parameter in flashvar is needed to be passed.

and for Image Rotator

1
<%= image_rotator() %>

The above command will render flash player or Image rotator with default configuration.
The helper method for flah player looks like:

1
player(player_options = {},config = {})

and for Image Rotator

1
image_rotator(player_options = {},config = {})

In which *player_options* contains options that you can pass for JW Flash Player, including flashvars supported by adobe flash.
Note: all the flashvars should be passed under :flahvars key in player_options as a hash like

1
@<%= player(:allowfullscreen   => 'true',:allowscriptaccess => 'true',{:flashvars => {:skin => '/swf/skins/bekle.swf', :height => '600', :file => '/sample.flv'}})%>

You can find list of supported flashvars for Flash Player here and flashvars for Image Rotator can be found here

It supports skin in both format either you can pass zip file or a swf file to skin flashvars.

Note: Given relative path should be relative to public folder of your application.

Credits

Credit for this plugin goes to JW Flash Player Team for making such a awsome flash player.

Future Addons

Adding Flash Chart functionality to this plugin.

More Info
Being very I am anable to provide detailed info here.
For any specific query or info you can write me at ‘bagwanpankaj[_at_]railsjaipur.in’

May42010

JW Silverlight Player Helper for Rails

Recently while working on a project I needed to add JW Silverlight player. But I found it difficult to manually setup every thing. so to I started to build it in ruby way and extrated the code to make it plugin.

Silverlight Player Helper provides you an Action View Helper method available to all views and provides all required files that are needed to build the player.

JW Silverlight Player supports wmv, wma and mp3 file formats. List of all supported format can be found here

How To Use

To use silverlight_player_helper you first need to install it as a plugin

1
  script/plugin install git://github.com/bagwanpankaj/silverlight_player_helper.git

And you are done. This command will automatically copies all required files to default folers under your public folder.
If it doesn’t do it automatically then run:

1
  rake sl_player:install

this rake task will copies all files to required folders.

Now to use this plugin write

1
  <%= jw_silverlight_player(:file => '/path/to/your/file.wmv',:width => 640, :height => 480) %>

The minimum required options are nothing. If no file is provided then it runs default file (supplied with plugin).
You can provide all options supported by JW Silverlight Player. These options can be found here

For more info write me at
bagwan.pankaj[_at_]railsjaipur.in

Get Adobe Flash playerPlugin by wpburn.com wordpress themes