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 - Soundcloud
- Livestream.com - Livestream.com
- Twitch.tv - Twitch.tv
- Justin.tv
- Ustream - Ustream
- RTMP livestreams - RTMP livestreams

View File

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

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "1.7.6", "version": "1.7.7",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "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. 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 fs = require("fs");
var Logger = require("./logger.js"); var Logger = require("./logger.js");

View File

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

View File

@ -28,6 +28,9 @@ var Media = function(data) {
case "tw": case "tw":
this.initTwitch(); this.initTwitch();
break; break;
case "jt":
this.initJustinTV();
break;
case "rt": case "rt":
this.initRTMP(); this.initRTMP();
break; break;
@ -322,6 +325,33 @@ Media.prototype.initTwitch = function() {
this.seek = 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() { Media.prototype.initRTMP = function() {
this.removeOld(); this.removeOld();
var url = "http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf"; 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.soundcloud.com/(songid)</li>
<li>http://www.dailymotion.com/video/(videoid)</li> <li>http://www.dailymotion.com/video/(videoid)</li>
<li>http://www.twitch.tv/(channel)</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.livestream.com/(channel)</li>
<li>http://www.ustream.tv/(channel)</li> <li>http://www.ustream.tv/(channel)</li>
<li>rtmp://(stream url)</li> <li>rtmp://(stream url)</li>