Simple Audioplayer

Simple audioplayer for Rails apps, based on SoundManager2, has support for playlists.

Installation

Add this line to your application's Gemfile:

gem 'simple_audioplayer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_audioplayer

Usage

Include this line to your app/assets/application.js:

//= require simple_audioplayer

or

#= require simple_audioplayer

if you use CoffeeScript (application.js.coffee).

Example expalins it better:

<div>
    <a data-behavior="player_switch_to_prev_track" href="#">PREV</a>
    |
    <a data-behavior="play_first_or_existing_track_on_page" href="#">PLAY</a>
    |
    <a data-behavior="player_switch_to_next_track" href="#">NEXT</a>
    <ul data-music-container>
        <li data-track-container>
            <a data-audio-track data-behavior="play_audio_track" data-id="1" data-title="Coldplay - Viva La Vida" data-url="/music/my_track.mp3" href="#">
                <i class="icon-play"></i>
            </a>
            <span>
                Coldplay - Viva La Vida
            </span>
        </li>

        <li data-track-container>
            ...
        </li>
    </ul>
</div>

Note:

Please copy public/sm2_swf to your public/ catalog (sm2_swf catalog contains flash audioplayers for cases when HTML5 Audio MP3 support isn't available). You can find it on GitHub: http://github.com/dmitrydims/simple_audioplayer.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request