CyTube/player/rtmp.coffee

27 lines
817 B
CoffeeScript
Raw Normal View History

2015-06-20 02:12:48 +00:00
window.rtmpEventHandler = (id, event, data) ->
if event == 'volumechange'
PLAYER.volume = if data.muted then 0 else data.volume
2015-06-30 01:32:18 +00:00
window.RTMPPlayer = class RTMPPlayer extends EmbedPlayer
2015-06-20 02:12:48 +00:00
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)