From 8c32ce4020dc1be46cbf243744332c701fd485a1 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Fri, 28 Feb 2014 09:43:48 -0600 Subject: [PATCH] Add no_h264 option --- templates/useroptions.jade | 4 ++++ www/js/data.js | 16 +++++++++++++++- www/js/util.js | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/templates/useroptions.jade b/templates/useroptions.jade index 7ab992ad..1e7ea19e 100644 --- a/templates/useroptions.jade +++ b/templates/useroptions.jade @@ -59,6 +59,10 @@ mixin us-playback .col-sm-4 .col-sm-8 p.text-info Setting wmode=transparent allows objects to be displayed above the video player, but may cause performance issues on some systems. + mixin rcheckbox("us-no-h264", "Use JWPlayer for h.264 playback") + .col-sm-4 + .col-sm-8 + p.text-info Some browsers (e.g. Firefox <=28) do not support native h.264 video playback. This option allows such content to be played using JWPlayer's flash player. mixin rcheckbox("us-hidevideo", "Remove the video player") mixin rcheckbox("us-playlistbuttons", "Hide playlist buttons by default") mixin rcheckbox("us-oldbtns", "Old style playlist buttons") diff --git a/www/js/data.js b/www/js/data.js index 10094903..83376954 100644 --- a/www/js/data.js +++ b/www/js/data.js @@ -98,6 +98,19 @@ function getOrDefault(k, def) { return v; } +function default_noh264() { + var ua = navigator.userAgent + ""; + if (ua.match(/Chrome|Chromium/)) { + return false; + } else if (ua.match(/Firefox/)) { + var version = ua.match(/Firefox\/(\d+)/)[1]; + version = parseInt(version); + return version >= 29; + } else { + return true; + } +} + var USEROPTS = { theme : getOrDefault("theme", "/css/themes/slate.css"), layout : getOrDefault("layout", "fluid"), @@ -120,7 +133,8 @@ var USEROPTS = { sort_afk : getOrDefault("sort_afk", false), default_quality : getOrDefault("default_quality", ""), 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 = parseFloat(getOrDefault("volume", 1)); diff --git a/www/js/util.js b/www/js/util.js index b7a4d61e..6646866e 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -601,6 +601,7 @@ function showUserOptions() { $("#us-synch").prop("checked", USEROPTS.synch); $("#us-synch-accuracy").val(USEROPTS.synch_accuracy); $("#us-wmode-transparent").prop("checked", USEROPTS.wmode_transparent); + $("#us-no-h264").prop("checked", USEROPTS.no_h264); $("#us-hidevideo").prop("checked", USEROPTS.hidevid); $("#us-playlistbuttons").prop("checked", USEROPTS.qbtn_hide); $("#us-oldbtns").prop("checked", USEROPTS.qbtn_idontlikechange); @@ -631,6 +632,7 @@ function saveUserOptions() { USEROPTS.synch = $("#us-synch").prop("checked"); USEROPTS.synch_accuracy = parseFloat($("#us-synch-accuracy").val()) || 2; USEROPTS.wmode_transparent = $("#us-wmode-transparent").prop("checked"); + USEROPTS.no_h264 = $("#us-no-h264").prop("checked"); USEROPTS.hidevid = $("#us-hidevideo").prop("checked"); USEROPTS.qbtn_hide = $("#us-playlistbuttons").prop("checked"); USEROPTS.qbtn_idontlikechange = $("#us-oldbtns").prop("checked");