Module: RubyHammer::FlowPlayerHelper
- Defined in:
- lib/rflowplayer.rb
Constant Summary collapse
- DEFAULT_PLAYER_OPTIONS =
{ :width => 400, :height => 300, :src => '/swf/FlowPlayerDark.swf' }
- DEFAULT_CONFIG_OPTIONS =
{ :auto_play => false, :auto_buffering => true, :show_menu => false }
Instance Method Summary collapse
- #flowplayer(id, player_options = {}, config_options = {}) ⇒ Object
- #hash_to_flowplayer_options(options) ⇒ Object
Instance Method Details
#flowplayer(id, player_options = {}, config_options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/rflowplayer.rb', line 19 def flowplayer(id, ={}, ={}) = DEFAULT_PLAYER_OPTIONS.dup.update() = DEFAULT_CONFIG_OPTIONS.dup.update() out = "<script type=\"text/javascript\"> var #{id.gsub('-', '_')}_api = flashembed(\"#{id}\"," out << () out << ", {config: " out << () out << "}); </script>" end |
#hash_to_flowplayer_options(options) ⇒ Object
3 4 5 |
# File 'lib/rflowplayer.rb', line 3 def () '{' + .map {|k, v| "#{k.to_s.downcase.camelcase(:lower)}: #{v.is_a?(String) ? "'#{v}'" : v.to_s}"}.join(', ') + '}' end |