Closed ebuzzz closed 8 years ago
I've never experienced this so I'm not sure I want to stray away from the native event. If you look at the W3 test media page there seems to be no sign of an erratic onTimeUpdate event https://www.w3.org/2010/05/video/mediaevents.html
Sorry, erratic isn't the correct word. I mean that the update interval is not the same for each browser. The specs says:
Every 15 to 250ms, or whenever the MediaController's media controller position changes, whichever happens least often, the user agent must queue a task to fire a simple event named timeupdate at the MediaController.
This interval is perfectly fine for updating timers, but I am using the library to render a play 'needle '. With the normal onTimeUpdate, this means the needle will jump from position to position, because it's only updated a few times a second. With requestAnimationFrame, this should be something like 60 times a second.
Currently, the onTimeUpdate for the HTML5 player is based on the ontimeupdate event that is triggered by the browser. The interval for this event is erratic and a best-effort system ('somewhere between 15 and 250ms').
Using the requestAnimationFrame for fetch the current position seems to be a better setup.
I've added pull request #9 that implements the feature, without backwards compatibility...