WIP - trying to fix a seeking bug.
--- a/src/js/pop.js Tue Jan 10 11:40:31 2012 +0100
+++ b/src/js/pop.js Tue Jan 10 14:38:58 2012 +0100
@@ -2,7 +2,12 @@
popcorn is a bit unstable at the time */
IriSP.PopcornReplacement = {
- msgPump : {} /* used by jquery to receive and send messages */
+ msgPump : {} /* used by jquery to receive and send messages */,
+ __fake_currentTime : 0, /* when the stream is too slow, some events which depend
+ on event "seeked" react to quickly and pickup the wrong currentTime.
+ That's why we store the future currentTime in a var until the player
+ has finished seeking */
+ __faking : false
};
IriSP.PopcornReplacement.media = {
@@ -77,12 +82,18 @@
IriSP.PopcornReplacement.currentTime = function(time) {
if (typeof(time) === "undefined") {
+ if (IriSP.PopcornReplacement.__faking === true) {
+ return IriSP.PopcornReplacement.__fake_currentTime;
+ }
+
return jwplayer(IriSP.PopcornReplacement._container).getPosition();
} else {
var currentTime = +time;
jwplayer( IriSP.PopcornReplacement._container ).seek( currentTime );
+ IriSP.PopcornReplacement.__fake_currentTime = currentTime;
IriSP.PopcornReplacement.trigger("seeked");
- return jwplayer(IriSP.PopcornReplacement._container).getPosition();
+ //return jwplayer(IriSP.PopcornReplacement._container).getPosition();
+ return currentTime;
}
};
@@ -184,6 +195,9 @@
IriSP.PopcornReplacement.__playHandler = function(event) {
+ if (IriSP.PopcornReplacement.__faking === true)
+ IriSP.PopcornReplacement.__faking = false;
+
IriSP.PopcornReplacement.media.paused = false;
IriSP.PopcornReplacement.trigger("play");
};