SoundManager 2 for Rails 3/4
Easy and non-obtrusive way to get SoundManager 2 as a dep for rails3/rails4.
Note: This gem differs from glaszig's "soundmanager-rails" in that all it only exposes the js and swf files for usage in the asset pipeline. It does not auto-intialize soundmanager when required, nor change what is required based upon your env. It only exposes the assets for manual use and uses versioning that follows soundmanager2's development.
Add to Gemfile:
Add to application.js manifest:
//= require soundmanager2
Or one of the other js files soundmanager2 provides:
//= require soundmanager2-jsmin //= require soundmanager2-nodebug-jsmin //= require soundmanager2-nodebug
# config/application.rb config.assets.precompile += %w(soundmanager2.swf soundmanager2_flash9.swf)
You probably want to include some config. I normally have a "settings.html.erb" which allows me to use the asset_path helper to deliver the correct swf. It also lets me easily toggle debug mode, etc.
soundManager.debugMode = false soundManager.flashVersion = 9 soundManager.multiShot = false soundManager.url = "<%= asset_path('soundmanager2.swf') %>" soundManager.useHTML5Audio = true soundManager.consoleOnly = true
See the SoundManager2 docs for info about how to initialize and use.
This gem only includes the cross-domain flash files (because that's what I use.)
Versions of soundmanager2-rails follow soundmanager2 versioning to make life more understandable.
The current soundmanager2 version at time of this readme is 2.97a-20170601
In gemfile, you can specify:
# Note: we can't include an "a" in the Minor version, since gems don't support it gem "soundmanager2-rails", "2.97.20170601"
Not up to date?
Send a pull request or bug me on github.
Updating this gem
Reminding myself for 6 months down the line :)
- Update the swf and js files with the cross-domain versions
- Update VERSION
bundle && bundle exec rake gemspec bundle exec rake release