SoundManager on Rails
This is the original SoundManager2 wrapped in a gem for easy use with Rails' asset pipeline.
Installation
Add this line to your application's Gemfile:
gem 'soundmanager-rails'
Or use bleeding edge code from Github:
gem 'soundmanager-rails', github: 'glaszig/soundmanager-rails'
And then execute:
$ bundle
Usage
Add this to your Sprockets manifest:
//= require soundmanager
This asset will load
soundmanager2.js
orsoundmanager2-nodebug.js
in case of yourRails.env
being set todevelopment
or<anything>
, respectively.
Additionally,window.soundManager.url
will be set to the proper asset url to load fallback swf files.
and you're good to go.
Of course, you can just load the SoundManager library itself using one of the following lines:
//= require soundmanager2
//= require soundmanager2-jsmin
//= require soundmanager2-nodebug
//= require soundmanager2-nodebug-jsmin
Notes
- This gem uses the cross-domain enabled flash files distributed with sm2 by default to make integration with external asset hosts easy.
Thanks to @liufengyun for testing this.
Contributing
- 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
Updating vendor file
To just upgrade to the latest SoundManager2 version you can use the rake tasks:
rake update:sources
License
See the LICENSE file.
SoundManager2 is BSD-licensed.