From 5c50e9345844dd606d10e19af687ba18dbcfff4f Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sun, 8 Nov 2015 19:51:17 -0800 Subject: [PATCH] Use VideoJS for RTMP (#532) --- player/rtmp.coffee | 26 ++++++++++---------------- www/js/player.js | 27 +++++++++------------------ 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/player/rtmp.coffee b/player/rtmp.coffee index 7d72d35f..ab3b6f96 100644 --- a/player/rtmp.coffee +++ b/player/rtmp.coffee @@ -2,25 +2,19 @@ window.rtmpEventHandler = (id, event, data) -> if event == 'volumechange' PLAYER.volume = if data.muted then 0 else data.volume -window.RTMPPlayer = class RTMPPlayer extends EmbedPlayer +window.RTMPPlayer = class RTMPPlayer extends VideoJSPlayer constructor: (data) -> if not (this instanceof RTMPPlayer) return new RTMPPlayer(data) - @volume = VOLUME - @load(data) + data.meta.direct = + # Quality is required for data.meta.direct processing but doesn't + # matter here because it's dictated by the stream. Arbitrarily + # choose 480. + 480: [ + { + link: data.id + } + ] - 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) diff --git a/www/js/player.js b/www/js/player.js index 2c0ea138..02c7a2fc 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -1006,28 +1006,19 @@ if (!(this instanceof RTMPPlayer)) { return new RTMPPlayer(data); } - this.volume = VOLUME; - this.load(data); - } - - RTMPPlayer.prototype.load = function(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 - } + data.meta.direct = { + 480: [ + { + link: data.id + } + ] }; - return RTMPPlayer.__super__.load.call(this, data); - }; - - RTMPPlayer.prototype.getVolume = function(cb) { - return cb(this.volume); - }; + RTMPPlayer.__super__.constructor.call(this, data); + } return RTMPPlayer; - })(EmbedPlayer); + })(VideoJSPlayer); HITBOX_ERROR = 'Hitbox.tv only serves its content over plain HTTP, but you are viewing this page over secure HTTPS. Your browser therefore blocks the hitbox embed due to mixed content policy. In order to view hitbox, you must view this page over plain HTTP (change "https://" to "http://" in the address bar)-- your websocket will still be connected using secure HTTPS. This is something I have asked Hitbox to fix but they have not done so yet.';