CyTube/player/rtmp.coffee
2015-06-29 18:32:18 -07:00

27 lines
817 B
CoffeeScript

window.rtmpEventHandler = (id, event, data) ->
if event == 'volumechange'
PLAYER.volume = if data.muted then 0 else data.volume
window.RTMPPlayer = class RTMPPlayer extends EmbedPlayer
constructor: (data) ->
if not (this instanceof RTMPPlayer)
return new RTMPPlayer(data)
@volume = VOLUME
@load(data)
load: (data) ->
data.meta.embed =
tag: 'object'
src: 'https://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf'
params:
flashvars: "src=#{data.id}&\
streamType=live&\
javascriptCallbackFunction=rtmpEventHandler&\
autoPlay=true&\
volume=#{VOLUME}"
super(data)
getVolume: (cb) ->
cb(@volume)