Add livestream.com player

This commit is contained in:
calzoneman 2015-06-16 12:50:17 -04:00
parent 480497bea4
commit cf5756227d
3 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,19 @@
window.LivestreamPlayer = class LivestreamPlayer extends Player
constructor: (data) ->
if not (this instanceof LivestreamPlayer)
return new LivestreamPlayer(data)
@load(data)
load: (data) ->
@setMediaProperties(data)
@player = $('<iframe/>').attr(
src: "https://cdn.livestream.com/embed/#{data.id}?\
layout=4&\
color=0x000000&\
iconColorOver=0xe7e7e7&\
iconColor=0xcccccc"
frameborder: '0'
)
removeOld(@player)

View File

@ -5,6 +5,7 @@ TYPE_MAP =
gd: VideoJSPlayer gd: VideoJSPlayer
gp: VideoJSPlayer gp: VideoJSPlayer
sc: SoundCloudPlayer sc: SoundCloudPlayer
li: LivestreamPlayer
window.loadMediaPlayer = (data) -> window.loadMediaPlayer = (data) ->
if data.type of TYPE_MAP if data.type of TYPE_MAP

View File

@ -1,5 +1,5 @@
(function() { (function() {
var DailymotionPlayer, Player, SoundCloudPlayer, TYPE_MAP, VideoJSPlayer, VimeoPlayer, YouTubePlayer, sortSources, var DailymotionPlayer, LivestreamPlayer, Player, SoundCloudPlayer, TYPE_MAP, VideoJSPlayer, VimeoPlayer, YouTubePlayer, sortSources,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty; hasProp = {}.hasOwnProperty;
@ -714,13 +714,37 @@
})(Player); })(Player);
window.LivestreamPlayer = LivestreamPlayer = (function(superClass) {
extend(LivestreamPlayer, superClass);
function LivestreamPlayer(data) {
if (!(this instanceof LivestreamPlayer)) {
return new LivestreamPlayer(data);
}
this.load(data);
}
LivestreamPlayer.prototype.load = function(data) {
this.setMediaProperties(data);
this.player = $('<iframe/>').attr({
src: "https://cdn.livestream.com/embed/" + data.id + "?layout=4&color=0x000000&iconColorOver=0xe7e7e7&iconColor=0xcccccc",
frameborder: '0'
});
return removeOld(this.player);
};
return LivestreamPlayer;
})(Player);
TYPE_MAP = { TYPE_MAP = {
yt: YouTubePlayer, yt: YouTubePlayer,
vi: VimeoPlayer, vi: VimeoPlayer,
dm: DailymotionPlayer, dm: DailymotionPlayer,
gd: VideoJSPlayer, gd: VideoJSPlayer,
gp: VideoJSPlayer, gp: VideoJSPlayer,
sc: SoundCloudPlayer sc: SoundCloudPlayer,
li: LivestreamPlayer
}; };
window.loadMediaPlayer = function(data) { window.loadMediaPlayer = function(data) {