A couple special cases for dailymotion (Fix #300)

This commit is contained in:
calzoneman 2013-10-24 17:31:04 -05:00
parent bc7a2e0ff1
commit f9c4685948
2 changed files with 20 additions and 3 deletions

View File

@ -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

View File

@ -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);
}
});
}