Embedded media player gets inconsistent currentPosition on both IE8 and Firefox3

Posted by logoin on Stack Overflow See other posts from Stack Overflow or by logoin
Published on 2010-06-16T20:32:25Z Indexed on 2010/06/16 22:52 UTC
Read the original article Hit count: 393

Filed under:
|
|
|

I have a embedded media player in the browser that is controlled by javascript to handle all the mediaChange event. The code looks like

mediaChangeHandler: function(media) {
    if (media && this.offset && !this.offsetJumpPerformed) {
        if (parseFloat(media.duration) > this.offset) {
            pos = parseInt(pos);
            this.getPlayer().controls.currentPosition = pos;
            alert("jump to position: " + this.getPlayer().controls.currentPosition);
            this.play();
            this.offsetJumpPerformed = true;
            alert("currentPosition:" + this.getPlayer().controls.currentPosition);
        }
    }
}

The first alert indicates the currentPosition is where I want it to be. However, the second alert would get currentPosition that's couple seconds less than what I have set up.

Does anyone have idea why? I tried googled it but haven't found anything useful. Thanks!

© Stack Overflow or respective owner

Related posts about browser

Related posts about mediaplayer