From f9c4685948d95cbcc4c8f9a2e8e94304004968fc Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 24 Oct 2013 17:31:04 -0500 Subject: [PATCH] A couple special cases for dailymotion (Fix #300) --- changelog | 5 +++++ www/assets/js/player.js | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/changelog b/changelog index af06329e..6eb31a2e 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +Thu Oct 24 17:29 2013 CDT + * www/assets/js/player.js: Add a special of special checks for + dailymotion because their player can only seek to the nearest + 2 seconds + Tue Oct 22 13:41 2013 CDT * lib/channel.js: Fix a channel dead race condition diff --git a/www/assets/js/player.js b/www/assets/js/player.js index 934f3d06..1e05dd2f 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -846,14 +846,26 @@ function handleMediaUpdate(data) { PLAYER.getTime(function (seconds) { var time = data.currentTime; var diff = time - seconds || time; + var acc = USEROPTS.sync_accuracy; + // Dailymotion can't seek more accurately than to the nearest + // 2 seconds. It gets stuck looping portions of the video + // at the default synch accuracy of 2. + // I've found 5 works decently. + if (PLAYER.type === "dm") + acc = Math.max(acc, 5.0); - if(diff > USEROPTS.sync_accuracy) { + if(diff > acc) { PLAYER.seek(time); - } else if(diff < -USEROPTS.sync_accuracy) { + } else if(diff < -acc) { // Don't synch all the way back, causes buffering problems // because for some dumb reason YouTube erases the buffer // when you seek backwards - PLAYER.seek(time + 1); + // + // ADDENDUM 2013-10-24 Except for dailymotion because + // their player is inaccurate + if (PLAYER.type !== "dm") + time += 1; + PLAYER.seek(time); } }); }