module Mp3Player::ViewHelper
This module contains the view helper mp3_player
and google_mp3_player
Public Class Methods
reset_player_count()
click to toggle source
# File lib/mp3_player/view_helper.rb, line 32 def self.reset_player_count @@player_count = 0 end
Public Instance Methods
google_mp3_player(path)
click to toggle source
# File lib/mp3_player/view_helper.rb, line 22 def google_mp3_player path %Q[ <embed type="application/x-shockwave-flash" wmode="transparent" src="http://www.google.com/reader/ui/3523697345-audio-player.swf?audioUrl=#{path}" height="27" width="320"></embed> ].html_safe end
increment_player_count()
click to toggle source
# File lib/mp3_player/view_helper.rb, line 28 def increment_player_count @@player_count += 1 end
mp3_player(path, options = {})
click to toggle source
This is the helper method you'll call in the view. <%= mp3_player @song.mp3.url %>
See the options at wpaudioplayer.com/standalone for more info on customising the player to match your site
# File lib/mp3_player/view_helper.rb, line 9 def mp3_player path, options = {} increment_player_count options.merge!({soundFile: path}) %Q[ <p id="audioplayer_#{@@player_count}">Alternative content</p> <script type="text/javascript"> AudioPlayer.embed("audioplayer_#{@@player_count}", #{options.to_json}); </script> ].html_safe end