23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/jw_player_helper/helper.rb', line 23
def video_player(flashvars, attributes = {} , params = {})
flashvars[:skin] = "/swf/skins/#{flashvars[:skin]}.zip" if flashvars[:skin]
attributes = DEFAULT_ATTRIBUTES.merge(attributes)
flashvars = DEFAULT_FLASHVARS.merge(flashvars)
params = DEFAULT_PARAMS.merge(params)
result = %Q{<script type="text/javascript">
var flashvars_#{attributes[:id]} = #{flashvars.to_json};
var params_#{attributes[:id]} = #{params.to_json};
var attributes_#{attributes[:id]} = #{attributes.except(:width, :height, :message, :element).to_json};
swfobject.embedSWF('/swf/player.swf','#{attributes[:id]}','#{attributes[:width]}','#{attributes[:height]}','9','false', flashvars_#{attributes[:id]}, params_#{attributes[:id]}, attributes_#{attributes[:id]})
</script>
<#{attributes[:element]} id="#{attributes[:id]}">#{attributes[:message]}</#{attributes[:element]}>
}
result.respond_to?(:html_safe) ? result.html_safe : result
end
|