Module: JWPlayer::Rails::Helper
- Defined in:
- lib/jwplayer/rails/helper.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ id: 'jwplayer', flashplayer: '/assets/player.swf', width: '400', height: '300' }
Instance Method Summary collapse
- #jwplayer(options = {}) ⇒ Object
-
#jwplayer_assets ⇒ Object
Includes JWPlayer javascript library.
Instance Method Details
#jwplayer(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jwplayer/rails/helper.rb', line 15 def jwplayer( = {}) = DEFAULT_OPTIONS.merge() result = %Q{<div id='#{[:id]}'>This div will be replaced by the JW Player.</div> <script type='text/javascript'> jwplayer('#{[:id]}').setup(#{.except(:id).to_json}); </script>} result.respond_to?(:html_safe) ? result.html_safe : result end |
#jwplayer_assets ⇒ Object
Includes JWPlayer javascript library
11 12 13 |
# File 'lib/jwplayer/rails/helper.rb', line 11 def jwplayer_assets javascript_include_tag "jwplayer" end |