Add Justin.tv support

This commit is contained in:
calzoneman 2013-05-17 14:39:58 -04:00
parent 79ec535358
commit 66fbbb77ce
7 changed files with 51 additions and 2 deletions

View file

@ -27,6 +27,7 @@ The following media sources are currently supported:
- Soundcloud
- Livestream.com
- Twitch.tv
- Justin.tv
- Ustream
- RTMP livestreams

View file

@ -694,6 +694,7 @@ function mediaUpdate(chan, id) {
function isLive(type) {
return type == "li"
|| type == "tw"
|| type == "jt"
|| type == "rt"
|| type == "jw"
|| type == "us";
@ -759,6 +760,12 @@ Channel.prototype.enqueue = function(data, user) {
this.autoTemp(media, user);
this.queueAdd(media, idx);
break;
case "jt":
var media = new Media(data.id, "JustinTV - " + data.id, "--:--", "jt");
media.queueby = user ? user.name : "";
this.autoTemp(media, user);
this.queueAdd(media, idx);
break;
case "us":
InfoGetter.getUstream(data.id, function(id) {
var media = new Media(id, "Ustream - " + data.id, "--:--", "us");

View file

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "1.7.6",
"version": "1.7.7",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

View file

@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const VERSION = "1.7.6";
const VERSION = "1.7.7";
var fs = require("fs");
var Logger = require("./logger.js");

View file

@ -500,6 +500,8 @@ function parseVideoURL(url){
}
else if(url.indexOf("twitch.tv") != -1)
return [parseTwitch(url), "tw"];
else if(url.indexOf("justin.tv") != -1)
return [parseJustinTV(url), "jt"];
else if(url.indexOf("livestream.com") != -1)
return [parseLivestream(url), "li"];
else if(url.indexOf("ustream.tv") != -1)
@ -544,6 +546,14 @@ function parseTwitch(url) {
return null;
}
function parseJustinTV(url) {
var m = url.match(/justin\.tv\/([a-zA-Z0-9]+)/);
if(m) {
return m[1];
}
return null;
}
function parseLivestream(url) {
var m = url.match(/livestream\.com\/([a-zA-Z0-9]+)/);
if(m) {

View file

@ -28,6 +28,9 @@ var Media = function(data) {
case "tw":
this.initTwitch();
break;
case "jt":
this.initJustinTV();
break;
case "rt":
this.initRTMP();
break;
@ -322,6 +325,33 @@ Media.prototype.initTwitch = function() {
this.seek = function() { }
}
Media.prototype.initJustinTV = function() {
this.removeOld();
var url = "http://www.justin.tv/widgets/live_embed_player.swf?channel="+this.id;
var params = {
allowFullScreen:"true",
allowScriptAccess:"always",
allowNetworking:"all",
movie:"http://www.justin.tv/widgets/live_embed_player.swf",
id: "live_embed_player_flash",
flashvars:"hostname=www.justin.tv&channel="+this.id+"&auto_play=true&start_volume=100"
};
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.initRTMP = function() {
this.removeOld();
var url = "http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf";

View file

@ -140,6 +140,7 @@
<li>http://www.soundcloud.com/(songid)</li>
<li>http://www.dailymotion.com/video/(videoid)</li>
<li>http://www.twitch.tv/(channel)</li>
<li>http://www.justin.tv/(channel)</li>
<li>http://www.livestream.com/(channel)</li>
<li>http://www.ustream.tv/(channel)</li>
<li>rtmp://(stream url)</li>