Merge branch 'streamable-1' into 3.0

This commit is contained in:
calzoneman 2016-08-07 21:27:38 -07:00
commit 96a5d657a5
6 changed files with 34 additions and 2 deletions

View file

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

View file

@ -15,6 +15,7 @@ TYPE_MAP =
us: UstreamPlayer
im: ImgurPlayer
vm: VideoJSPlayer
sb: VideoJSPlayer
window.loadMediaPlayer = (data) ->
try

View file

@ -11,6 +11,7 @@ var mediaquery = require("cytube-mediaquery");
var YouTube = require("cytube-mediaquery/lib/provider/youtube");
var Vimeo = require("cytube-mediaquery/lib/provider/vimeo");
var Vidme = require("cytube-mediaquery/lib/provider/vidme");
var Streamable = require("cytube-mediaquery/lib/provider/streamable");
/*
* Preference map of quality => youtube formats.
@ -560,6 +561,24 @@ var Getters = {
const media = new Media(video.id, video.title, video.duration,
"vm", video.meta);
process.nextTick(callback, false, media);
}).catch(function (err) {
callback(err.message || err, null);
});
},
/* streamable */
sb: function (id, callback) {
if (!/^[\w-]+$/.test(id)) {
process.nextTick(callback, "Invalid streamable.com ID");
return;
}
Streamable.lookup(id).then(video => {
const media = new Media(video.id, video.title, video.duration,
"sb", video.meta);
process.nextTick(callback, false, media);
}).catch(function (err) {
callback(err.message || err, null);
});
}
};

View file

@ -242,6 +242,8 @@
return id;
case "hb":
return "http://hitbox.tv/" + id;
case "sb":
return "https://streamable.com/" + id;
default:
return "";
}

View file

@ -1273,7 +1273,8 @@
hb: HitboxPlayer,
us: UstreamPlayer,
im: ImgurPlayer,
vm: VideoJSPlayer
vm: VideoJSPlayer,
sb: VideoJSPlayer
};
window.loadMediaPlayer = function(data) {

View file

@ -52,6 +52,8 @@ function formatURL(data) {
return data.id;
case "hb":
return "http://hitbox.tv/" + data.id;
case "sb":
return "https://streamable.com/" + data.id;
default:
return "#";
}
@ -1366,6 +1368,13 @@ function parseMediaLink(url) {
};
}
if((m = url.match(/streamable\.com\/([\w-]+)/))) {
return {
id: m[1],
type: "sb"
};
}
/* Shorthand URIs */
// To catch Google Plus by ID alone
if ((m = url.match(/^(?:gp:)?(\d{21}_\d{19}_\d{19})/))) {