I noticed a little inconsistency, which I hope to check either as the quirk of HTML5, or something special for Video.js .
It seems that if you call the Video.js' currentTime() function, providing a new time, any further calls to currentTime() (to get the current time) will not return the correct time (it will return the previous time) until the timeupdate event timeupdate . After the timeupdate event timeupdate currentTime() will return the correct time.
For example, if the video has not started yet, but Video.js has loaded together with all the metafiles, etc.:
videoPlayer.addEvent('timeupdate', function() { console.log('Event callback: ' + player.currentTime); }); console.log('Original time: ' + player.currentTime); player.currentTime(100); console.log('New time: ' + player.currentTime);
The result that I expected would look like this:
Original time: 0 New time: 100 Event callback: 100
However, I get the following:
Original time: 0 New time: 0 Event callback: 100
Any insight would be fantastic!
Edit: I can reproduce this in Chrome and Safari on OSX, but not on Firefox on OSX (all using HTML5). I can also reproduce this on IE8 using Flash Player and IE9 using HTML5 player.
source share