Add option to use JWPlayer for h.264

This commit is contained in:
calzoneman 2014-01-07 19:24:03 -06:00
parent c6d214b981
commit 1efcca6be9
4 changed files with 26 additions and 3 deletions

View File

@ -1033,7 +1033,11 @@ Callbacks = {
}
if (data.type === "vi" && data.direct && data.direct.sd) {
data.type = "rv";
if (USEROPTS.no_h264) {
data.type = "jw";
} else {
data.type = "rv";
}
data.url = data.direct.sd.url;
}

View File

@ -97,6 +97,15 @@ function getOrDefault(k, def) {
return v;
}
function default_noh264() {
var ua = navigator.userAgent + "";
if (ua.match(/Firefox\/29.0|Chrome|Chromium/)) {
return false;
} else {
return true;
}
}
var USEROPTS = {
theme : getOrDefault("theme", "default"),
css : getOrDefault("css", ""),
@ -120,7 +129,8 @@ var USEROPTS = {
sort_afk : getOrDefault("sort_afk", false),
default_quality : getOrDefault("default_quality", "#quality_auto"),
boop : getOrDefault("boop", false),
secure_connection : getOrDefault("secure_connection", false)
secure_connection : getOrDefault("secure_connection", false),
no_h264 : getOrDefault("no_h264", default_noh264())
};
var VOLUME = getOrDefault("volume", 1);

View File

@ -731,12 +731,17 @@ var RTMPPlayer = function (data) {
var JWPlayer = function (data) {
var self = this;
self.videoId = data.id;
if (data.url) {
self.videoURL = data.url;
} else {
self.videoURL = data.id;
}
self.videoLength = data.seconds;
self.init = function () {
removeOld();
jwplayer("ytapiplayer").setup({
file: self.videoId,
file: self.videoURL,
width: VWIDTH,
height: VHEIGHT,
autostart: true

View File

@ -662,6 +662,9 @@ function showOptionsMenu() {
"issues on some systems");
addOption(playback, "", pl_wmodewarn);
var pl_noh264 = addCheckbox(playback, "h.264", "Use JWPlayer for h.264 playback");
pl_noh264.prop("checked", USEROPTS.no_h264);
var pl_hide = addCheckbox(playback, "Hide Video",
"Remove the video player");
pl_hide.prop("checked", USEROPTS.hidevid);
@ -731,6 +734,7 @@ function showOptionsMenu() {
USEROPTS.hidevid = pl_hide.prop("checked");
USEROPTS.qbtn_hide = pl_hidebtn.prop("checked");
USEROPTS.qbtn_idontlikechange = pl_oldbtn.prop("checked");
USEROPTS.no_h264 = pl_noh264.prop("checked");
USEROPTS.show_timestamps = chat_time.prop("checked");
USEROPTS.sort_rank = chat_sort_rank.prop("checked");
USEROPTS.sort_afk = chat_sort_afk.prop("checked");