Add clientside support for Google+

This commit is contained in:
Calvin Montgomery 2014-07-10 23:23:48 -07:00
parent c522516b88
commit 8acffda8ec
2 changed files with 41 additions and 0 deletions

View file

@ -878,6 +878,10 @@ Callbacks = {
data = vimeoSimulator2014(data); data = vimeoSimulator2014(data);
} }
if (data.type === "gp") {
data = googlePlusSimulator2014(data);
}
/* RTMP player has been replaced with the general flash player */ /* RTMP player has been replaced with the general flash player */
if (data.type === "rt") { if (data.type === "rt") {
data.url = data.id; data.url = data.id;

View file

@ -1280,6 +1280,13 @@ function parseMediaLink(url) {
}; };
} }
if ((m = url.match(/plus\.google\.com\/(?:u\/\d+\/)?photos\/(\d+)\/albums\/(\d+)\/(\d+)/))) {
return {
id: m[1] + "_" + m[2] + "_" + m[3],
type: "gp"
};
}
/* Raw file */ /* Raw file */
var tmp = url.split("?")[0]; var tmp = url.split("?")[0];
if (tmp.match(/^https?:\/\//)) { if (tmp.match(/^https?:\/\//)) {
@ -2725,3 +2732,33 @@ function vimeoSimulator2014(data) {
data.url = data.meta.direct[q].url; data.url = data.meta.direct[q].url;
return data; return data;
} }
function googlePlusSimulator2014(data) {
/* Google+ Simulator uses the raw file player */
data.type = "fi";
/* For browsers that don't support native h264 playback */
if (USEROPTS.no_h264) {
data.forceFlash = true;
}
/* Convert youtube-style quality key to vimeo workaround quality */
var q = USEROPTS.default_quality || "auto";
var fallbacks = ["hd1080", "hd720", "large", "medium", "small"];
var i = fallbacks.indexOf(q);
if (i < 0) {
// Default to 360p because 480p is Flash
i = fallbacks.indexOf("medium");
}
while (!(q in data.meta.direct) && i < fallbacks.length) {
q = fallbacks[i++];
}
if (i === fallbacks.length) {
q = "medium";
}
data.url = data.meta.direct[q];
return data;
}