From 03a188e8f261215f58fad4a8fa418a9ed803f0b0 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Fri, 16 May 2014 00:36:33 -0500 Subject: [PATCH] Improvements to Dailymotion player * Hide the logo by default * Set the wmode based on the user's preference * Automatic quality as with youtube --- templates/useroptions.jade | 2 +- www/js/player.js | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/templates/useroptions.jade b/templates/useroptions.jade index 8a630cc0..90aa36ce 100644 --- a/templates/useroptions.jade +++ b/templates/useroptions.jade @@ -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 quality + label.control-label.col-sm-4(for="#us-default-quality") Default YouTube/Dailymotion quality .col-sm-8 select#us-default-quality.form-control option(value="auto") Auto diff --git a/www/js/player.js b/www/js/player.js index ad92ccb0..0750d814 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -350,11 +350,32 @@ var DailymotionPlayer = function (data) { removeOld(); self.videoId = data.id; self.videoLength = data.seconds; + + var q = undefined; + if (USEROPTS.default_quality) { + /* Map youtube-style quality names to dailymotion values */ + q = { + small: 240, + medium: 380, + large: 480, + hd720: 720, + hd1080: 1080, + highres: 1080 + }[USEROPTS.default_quality]; + } + + var params = { + autoplay: 1, + wmode: USEROPTS.wmode_transparent ? "transparent" : "opaque", + quality: q, + logo: 0 + }; + self.player = DM.player("ytapiplayer", { video: data.id, width: parseInt(VWIDTH, 10), height: parseInt(VHEIGHT, 10), - params: { autoplay: 1 } + params: params }); self.player.addEventListener("apiready", function (e) {