Add imgur and ustream

This commit is contained in:
calzoneman 2015-06-21 10:39:16 -04:00
parent 8dd3280305
commit b34f972629
4 changed files with 74 additions and 2 deletions

12
player/imgur.coffee Normal file
View File

@ -0,0 +1,12 @@
window.ImgurPlayer = class ImgurPlayer extends CustomEmbedPlayer
constructor: (data) ->
if not (this instanceof ImgurPlayer)
return new ImgurPlayer(data)
@load(data)
load: (data) ->
data.meta.embed =
tag: 'iframe'
src: "https://imgur.com/a/#{data.id}/embed"
super(data)

View File

@ -10,6 +10,8 @@ TYPE_MAP =
cu: CustomEmbedPlayer
rt: RTMPPlayer
hb: HitboxPlayer
us: UstreamPlayer
im: ImgurPlayer
window.loadMediaPlayer = (data) ->
if data.type of TYPE_MAP

12
player/ustream.coffee Normal file
View File

@ -0,0 +1,12 @@
window.UstreamPlayer = class UstreamPlayer extends CustomEmbedPlayer
constructor: (data) ->
if not (this instanceof UstreamPlayer)
return new UstreamPlayer(data)
@load(data)
load: (data) ->
data.meta.embed =
tag: 'iframe'
src: "https://www.ustream.tv/embed/#{data.id}?v=3&wmode=direct&autoplay=1"
super(data)

View File

@ -1,5 +1,5 @@
(function() {
var CustomEmbedPlayer, DEFAULT_ERROR, DailymotionPlayer, HITBOX_ERROR, HitboxPlayer, LivestreamPlayer, Player, RTMPPlayer, SoundCloudPlayer, TYPE_MAP, TwitchPlayer, VideoJSPlayer, VimeoPlayer, YouTubePlayer, genParam, sortSources,
var CustomEmbedPlayer, DEFAULT_ERROR, DailymotionPlayer, HITBOX_ERROR, HitboxPlayer, ImgurPlayer, LivestreamPlayer, Player, RTMPPlayer, SoundCloudPlayer, TYPE_MAP, TwitchPlayer, UstreamPlayer, VideoJSPlayer, VimeoPlayer, YouTubePlayer, genParam, 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; },
hasProp = {}.hasOwnProperty;
@ -921,6 +921,50 @@
})(CustomEmbedPlayer);
window.UstreamPlayer = UstreamPlayer = (function(superClass) {
extend(UstreamPlayer, superClass);
function UstreamPlayer(data) {
if (!(this instanceof UstreamPlayer)) {
return new UstreamPlayer(data);
}
this.load(data);
}
UstreamPlayer.prototype.load = function(data) {
data.meta.embed = {
tag: 'iframe',
src: "https://www.ustream.tv/embed/" + data.id + "?v=3&wmode=direct&autoplay=1"
};
return UstreamPlayer.__super__.load.call(this, data);
};
return UstreamPlayer;
})(CustomEmbedPlayer);
window.ImgurPlayer = ImgurPlayer = (function(superClass) {
extend(ImgurPlayer, superClass);
function ImgurPlayer(data) {
if (!(this instanceof ImgurPlayer)) {
return new ImgurPlayer(data);
}
this.load(data);
}
ImgurPlayer.prototype.load = function(data) {
data.meta.embed = {
tag: 'iframe',
src: "https://imgur.com/a/" + data.id + "/embed"
};
return ImgurPlayer.__super__.load.call(this, data);
};
return ImgurPlayer;
})(CustomEmbedPlayer);
TYPE_MAP = {
yt: YouTubePlayer,
vi: VimeoPlayer,
@ -932,7 +976,9 @@
tw: TwitchPlayer,
cu: CustomEmbedPlayer,
rt: RTMPPlayer,
hb: HitboxPlayer
hb: HitboxPlayer,
us: UstreamPlayer,
im: ImgurPlayer
};
window.loadMediaPlayer = function(data) {