Sha256: 3dd4e1aa4aa19e0a7e21f0ebda1c29fb65a21e12eea87e82763236715f50aad1
Contents?: true
Size: 977 Bytes
Versions: 1
Compression:
Stored size: 977 Bytes
Contents
module RubyHammer module FlowPlayerHelper def hash_to_flowplayer_options(options) '{' + options.map {|k, v| "#{k.to_s.downcase.camelcase(:lower)}: #{v.is_a?(String) ? "'#{v}'" : v.to_s}"}.join(', ') + '}' end DEFAULT_PLAYER_OPTIONS = { :width => 400, :height => 300, :src => '/swf/FlowPlayerDark.swf' } DEFAULT_CONFIG_OPTIONS = { :auto_play => false, :auto_buffering => true, :show_menu => false } def flowplayer(id, player_options={}, config_options={}) player_options = DEFAULT_PLAYER_OPTIONS.dup.update(player_options) config_options = DEFAULT_CONFIG_OPTIONS.dup.update(config_options) out = "<script type=\"text/javascript\"> var #{id.gsub('-', '_')}_api = flashembed(\"#{id}\"," out << hash_to_flowplayer_options(player_options) out << ", {config: " out << hash_to_flowplayer_options(config_options) out << "}); </script>" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rflowplayer-0.1.0 | lib/rflowplayer.rb |