Support RTMP streams
This commit is contained in:
parent
109260e46c
commit
176dd58284
20
channel.js
20
channel.js
|
|
@ -563,6 +563,14 @@ Channel.prototype.enqueue = function(data) {
|
||||||
pos: idx
|
pos: idx
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "rt":
|
||||||
|
var media = new Media(data.id, "Livestream", "--:--", "rt");
|
||||||
|
this.queue.splice(idx, 0, media);
|
||||||
|
this.sendAll("queue", {
|
||||||
|
media: media.pack(),
|
||||||
|
pos: idx
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -658,7 +666,8 @@ Channel.prototype.playNext = function() {
|
||||||
|
|
||||||
// If it's not a livestream, enable autolead
|
// If it's not a livestream, enable autolead
|
||||||
if(this.leader == null && this.media.type != "tw"
|
if(this.leader == null && this.media.type != "tw"
|
||||||
&& this.media.type != "li") {
|
&& this.media.type != "li"
|
||||||
|
&& this.media.type != "rt") {
|
||||||
this.time = new Date().getTime();
|
this.time = new Date().getTime();
|
||||||
mediaUpdate(this, this.media.id);
|
mediaUpdate(this, this.media.id);
|
||||||
}
|
}
|
||||||
|
|
@ -698,7 +707,8 @@ Channel.prototype.jumpTo = function(pos) {
|
||||||
|
|
||||||
// If it's not a livestream, enable autolead
|
// If it's not a livestream, enable autolead
|
||||||
if(this.leader == null && this.media.type != "tw"
|
if(this.leader == null && this.media.type != "tw"
|
||||||
&& this.media.type != "li") {
|
&& this.media.type != "li"
|
||||||
|
&& this.media.type != "rt") {
|
||||||
this.time = new Date().getTime();
|
this.time = new Date().getTime();
|
||||||
mediaUpdate(this, this.media.id);
|
mediaUpdate(this, this.media.id);
|
||||||
}
|
}
|
||||||
|
|
@ -733,7 +743,8 @@ Channel.prototype.tryUpdate = function(user, data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.media.type == "li" || this.media.type == "tw") {
|
if(this.media.type == "li" || this.media.type == "tw" ||
|
||||||
|
this.media.type == "rt") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1057,7 +1068,8 @@ Channel.prototype.changeLeader = function(name) {
|
||||||
if(name == "") {
|
if(name == "") {
|
||||||
this.logger.log("*** Resuming autolead");
|
this.logger.log("*** Resuming autolead");
|
||||||
if(this.media != null && this.media.type != "li"
|
if(this.media != null && this.media.type != "li"
|
||||||
&& this.media.type != "tw") {
|
&& this.media.type != "tw"
|
||||||
|
&& this.media.type != "rt") {
|
||||||
this.time = new Date().getTime();
|
this.time = new Date().getTime();
|
||||||
this.i = 0;
|
this.i = 0;
|
||||||
mediaUpdate(this, this.media.id);
|
mediaUpdate(this, this.media.id);
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,8 @@ function synchtubeLayout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onYouTubeIframeAPIReady() {
|
function onYouTubeIframeAPIReady() {
|
||||||
PLAYER = new Media({id: "", type: "yt"});
|
if(!PLAYER)
|
||||||
|
PLAYER = new Media({id: "", type: "yt"});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createCookie(name,value,days) {
|
function createCookie(name,value,days) {
|
||||||
|
|
|
||||||
|
|
@ -360,7 +360,10 @@ function parseVideoURL(url){
|
||||||
url = url.trim()
|
url = url.trim()
|
||||||
if(typeof(url) != "string")
|
if(typeof(url) != "string")
|
||||||
return null;
|
return null;
|
||||||
if(url.indexOf("youtu.be") != -1 || url.indexOf("youtube.com") != -1) {
|
if(url.indexOf("rtmp://") == 0) {
|
||||||
|
return [url, "rt"];
|
||||||
|
}
|
||||||
|
else if(url.indexOf("youtu.be") != -1 || url.indexOf("youtube.com") != -1) {
|
||||||
if(url.indexOf("playlist") != -1) {
|
if(url.indexOf("playlist") != -1) {
|
||||||
return [parseYTPlaylist(url), "yp"];
|
return [parseYTPlaylist(url), "yp"];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ var Media = function(data) {
|
||||||
case "tw":
|
case "tw":
|
||||||
this.initTwitch();
|
this.initTwitch();
|
||||||
break;
|
break;
|
||||||
|
case "rt":
|
||||||
|
this.initRTMP();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -223,6 +226,34 @@ Media.prototype.initTwitch = function() {
|
||||||
this.seek = function() { }
|
this.seek = function() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Media.prototype.initRTMP = function() {
|
||||||
|
this.removeOld();
|
||||||
|
var url = "http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf";
|
||||||
|
var src = encodeURIComponent(this.id);
|
||||||
|
var params = {
|
||||||
|
allowFullScreen:"true",
|
||||||
|
allowScriptAccess:"always",
|
||||||
|
allowNetworking:"all",
|
||||||
|
wMode:"direct",
|
||||||
|
movie:"http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf",
|
||||||
|
flashvars:"src="+src+"&streamType=live&autoPlay=true"
|
||||||
|
};
|
||||||
|
swfobject.embedSWF(url, "ytapiplayer", VWIDTH, VHEIGHT, "8", null, null, params, {} );
|
||||||
|
|
||||||
|
this.load = function(data) {
|
||||||
|
this.id = data.id;
|
||||||
|
this.initTwitch();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.pause = function() { }
|
||||||
|
|
||||||
|
this.play = function() { }
|
||||||
|
|
||||||
|
this.getTime = function() { }
|
||||||
|
|
||||||
|
this.seek = function() { }
|
||||||
|
}
|
||||||
|
|
||||||
Media.prototype.update = function(data) {
|
Media.prototype.update = function(data) {
|
||||||
if(data.id != this.id) {
|
if(data.id != this.id) {
|
||||||
this.load(data);
|
this.load(data);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue