From 08a39c8857999ae929b7fa34b8e2490080b6c240 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 26 Sep 2013 21:43:38 -0500 Subject: [PATCH] Fix the bug where the player repeats the first few seconds at the end --- changelog | 5 +++++ www/assets/js/player.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/changelog b/changelog index 6a2742f5..ad14c66c 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +Thu Sep 26 21:42 2013 CDT + * www/assets/js/player.js: Keep track of the duration of the current + video and use this information to prevent the player restarting when + it receives an out of range timestamp + Thu Sep 26 13:29 2013 CDT * lib/user.js: Some code style cleanup diff --git a/www/assets/js/player.js b/www/assets/js/player.js index a944dfad..44d6c437 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -27,6 +27,7 @@ var YouTubePlayer = function (data) { removeOld(); self.paused = false; self.videoId = data.id; + self.videoLength = data.seconds; var wmode = USEROPTS.wmode_transparent ? "transparent" : "opaque"; self.player = new YT.Player("ytapiplayer", { height: VHEIGHT, @@ -69,6 +70,7 @@ var YouTubePlayer = function (data) { if(VIDEOQUALITY) self.player.setPlaybackQuality(VIDEOQUALITY); self.videoId = data.id; + self.videoLength = data.seconds; } }; @@ -106,6 +108,7 @@ var VimeoPlayer = function (data) { var self = this; waitUntilDefined(window, "$f", function () { self.videoId = data.id; + self.videoLength = data.seconds; self.init = function () { var iframe = $("