Here’s a WordPress Audio Player plugin wrapper for Rails 3.x with asset pipeline support.
Simply add to your application’s Gemfile:
gem 'mp3_player'
In your layout add:
<%= mp3_player_headers %>
or:
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js' %> <%= mp3_player_headers without_swfobject: true %>
To check the player is working simply add:
<%= mp3_player("http://github.com/sekrett/mp3_player/raw/master/test.mp3") %>
to your view.
If you’re using paperclip or carrierwave:
<%= mp3_player @my_model.mp3.url %>
Additionally you can just use google’s MP3 player with the following helper:
<%= google_mp3_player @my_model.mp3.url %>
You may specify extra options (all colors should be expressed as hexadecimal values minus the ‘#’. eg.:
<%= mp3_player @my_model.mp3.url, { bg: "99FFFF", text: 'FF0000') %>
Also you may create a configuration yml file and set global options there:
rails generate mp3_player:yml
For a complete list of options see documentation at wpaudioplayer.com/standalone.
-
Fork it
-
Create your feature branch (‘git checkout -b my-new-feature`)
-
Commit your changes (‘git commit -am ’Added some feature’‘)
-
Push to the branch (‘git push origin my-new-feature`)
-
Create new Pull Request
This plugin is based on the Audio Player 2.0 by Martin Laine (wpaudioplayer.com/standalone)
Thanks to Matt Ittigson (github.com/mattenat) for inspiring changes to help support paperclip.
Copyright © 2009 Gavin Morrice (handyrailstips.com), released under the MIT license
Copyright © 2010-2013 Alexander Zubkov (github.com/sekrett), released under the MIT license