mirror of https://github.com/calzoneman/sync.git
Add support for livestream
This commit is contained in:
parent
bc187c99f5
commit
96bd8aa9bd
|
@ -283,6 +283,14 @@ Channel.prototype.enqueue = function(data) {
|
|||
pos: idx
|
||||
});
|
||||
}
|
||||
else if(data.type == "li") {
|
||||
var media = new Media(data.id, "Livestream ~ " + data.id, 0, "li");
|
||||
this.queue.splice(idx, 0, media);
|
||||
this.sendAll('queue', {
|
||||
media: media.pack(),
|
||||
pos: idx
|
||||
});
|
||||
}
|
||||
// Query metadata from Soundcloud
|
||||
else if(data.type == "sc") {
|
||||
var callback = (function(chan, id) { return function(res, data) {
|
||||
|
|
|
@ -146,6 +146,8 @@ function initCallbacks() {
|
|||
updateYT(data);
|
||||
else if(data.type == "tw")
|
||||
loadTwitch(data.id);
|
||||
else if(data.type == "li")
|
||||
loadLivestream(data.id);
|
||||
else if(data.type == "sc")
|
||||
updateSC(data);
|
||||
else if(data.type == "vi")
|
||||
|
|
|
@ -359,6 +359,14 @@ function loadTwitch(channel) {
|
|||
swfobject.embedSWF( url, "ytapiplayer", '640', '390', "8", null, null, params, {} );
|
||||
}
|
||||
|
||||
function loadLivestream(channel) {
|
||||
MEDIATYPE = "li";
|
||||
removeCurrentPlayer();
|
||||
flashvars = { channel: channel };
|
||||
params = { AllowScriptAccess: 'always' };
|
||||
swfobject.embedSWF("http://cdn.livestream.com/chromelessPlayer/v20/playerapi.swf", "ytapiplayer", "640", "390", "9.0.0", "expressInstall.swf", flashvars, params);
|
||||
}
|
||||
|
||||
function removeCurrentPlayer(){
|
||||
var currentEmbed = $("#ytapiplayer");
|
||||
var placeholder = $("<div/>").insertBefore(currentEmbed);
|
||||
|
@ -373,6 +381,8 @@ function parseVideoURL(url){
|
|||
return [parseYTURL(url), "yt"];
|
||||
else if(url.indexOf("twitch") != -1)
|
||||
return [parseTwitch(url), "tw"];
|
||||
else if(url.indexOf("livestream") != -1)
|
||||
return [parseLivestream(url), "li"];
|
||||
else if(url.indexOf("soundcloud") != -1)
|
||||
return [url, "sc"];
|
||||
else if(url.indexOf("vimeo") != -1)
|
||||
|
@ -411,6 +421,15 @@ function parseTwitch(url) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function parseLivestream(url) {
|
||||
var m = url.match(/livestream\.com\/([a-zA-Z0-9]*)/);
|
||||
if(m) {
|
||||
// Extract channel name
|
||||
return m[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function parseVimeo(url) {
|
||||
var m = url.match(/vimeo\.com\/([0-9]+)/);
|
||||
if(m) {
|
||||
|
|
Loading…
Reference in New Issue