Support RTMP streams
This commit is contained in:
parent
109260e46c
commit
176dd58284
4 changed files with 53 additions and 6 deletions
|
|
@ -394,7 +394,8 @@ function synchtubeLayout() {
|
|||
}
|
||||
|
||||
function onYouTubeIframeAPIReady() {
|
||||
PLAYER = new Media({id: "", type: "yt"});
|
||||
if(!PLAYER)
|
||||
PLAYER = new Media({id: "", type: "yt"});
|
||||
}
|
||||
|
||||
function createCookie(name,value,days) {
|
||||
|
|
|
|||
|
|
@ -360,7 +360,10 @@ function parseVideoURL(url){
|
|||
url = url.trim()
|
||||
if(typeof(url) != "string")
|
||||
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) {
|
||||
return [parseYTPlaylist(url), "yp"];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ var Media = function(data) {
|
|||
case "tw":
|
||||
this.initTwitch();
|
||||
break;
|
||||
case "rt":
|
||||
this.initRTMP();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -223,6 +226,34 @@ Media.prototype.initTwitch = 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) {
|
||||
if(data.id != this.id) {
|
||||
this.load(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue