Add ustream support

This commit is contained in:
calzoneman 2013-05-14 17:22:47 -04:00
parent e45489b77c
commit c1c3e4c47f
8 changed files with 84 additions and 5 deletions

View file

@ -502,6 +502,8 @@ function parseVideoURL(url){
return [parseTwitch(url), "tw"];
else if(url.indexOf("livestream.com") != -1)
return [parseLivestream(url), "li"];
else if(url.indexOf("ustream.tv") != -1)
return [parseUstream(url), "us"];
else if(url.indexOf("soundcloud.com") != -1)
return [url, "sc"];
else if(url.indexOf("vimeo.com") != -1)
@ -550,6 +552,14 @@ function parseLivestream(url) {
return null;
}
function parseUstream(url) {
var m = url.match(/ustream\.tv\/([a-zA-Z0-9-]+)/);
if(m) {
return m[1];
}
return null;
}
function parseVimeo(url) {
var m = url.match(/vimeo\.com\/([0-9]+)/);
if(m) {

View file

@ -34,6 +34,9 @@ var Media = function(data) {
case "jw":
this.initJWPlayer();
break;
case "us":
this.initUstream();
break;
default:
this.nullPlayer();
break;
@ -373,6 +376,31 @@ Media.prototype.initJWPlayer = function() {
this.seek = function() { }
}
Media.prototype.initUstream = function() {
var iframe = $("<iframe/>").insertBefore($("#ytapiplayer"));
$("#ytapiplayer").remove();
iframe.attr("id", "ytapiplayer");
iframe.attr("width", VWIDTH);
iframe.attr("height", VHEIGHT);
iframe.attr("src", "http://www.ustream.tv/embed/"+this.id+"?v=3&wmode=direct");
iframe.attr("frameborder", "0");
iframe.attr("scrolling", "no");
iframe.css("border", "none");
this.load = function(data) {
this.id = data.id;
this.initUstream();
}
this.pause = function() { }
this.play = function() { }
this.getTime = function() { }
this.seek = function() { }
}
Media.prototype.update = function(data) {
if(data.id && data.id != this.id) {
if(data.currentTime < 0) {