Make vimeo workaround respect default quality option

This commit is contained in:
Calvin Montgomery 2014-05-16 00:46:30 -05:00
parent 03a188e8f2
commit d16482b863
2 changed files with 27 additions and 4 deletions

View file

@ -67,7 +67,7 @@ mixin us-playback
mixin rcheckbox("us-playlistbuttons", "Hide playlist buttons by default")
mixin rcheckbox("us-oldbtns", "Old style playlist buttons")
.form-group
label.control-label.col-sm-4(for="#us-default-quality") Default YouTube/Dailymotion quality
label.control-label.col-sm-4(for="#us-default-quality") Default YouTube/Vimeo/Dailymotion quality
.col-sm-8
select#us-default-quality.form-control
option(value="auto") Auto

View file

@ -858,9 +858,32 @@ Callbacks = {
} else {
data.type = "rv";
}
// Right now only plays standard definition.
// In the future, I may add a quality selector for mobile/standard/HD
data.url = data.direct.sd.url;
/* Convert youtube-style quality key to vimeo workaround quality */
var q = {
small: "mobile",
medium: "sd",
large: "sd",
hd720: "hd",
hd1080:"hd",
highres: "hd"
}[USEROPTS.default_quality] || "sd";
var fallback = {
hd: "sd",
sd: "mobile",
mobile: false
};
while (!(q in data.direct) && q != false) {
q = fallback[q];
}
if (!q) {
q = "sd";
}
data.url = data.direct[q].url;
}
if (data.type === "rt") {