souporserious / react-media-player

React audio and video player.
https://souporserious.github.io/react-media-player/
ISC License
470 stars 100 forks source link

Use requestAnimationFrame for time updates in HTML5 vendor #9

Closed ebuzzz closed 8 years ago

ebuzzz commented 8 years ago

The onTimeUpdate event from the browser is lagging. By using requestAnimationFrame (just like the Youtube player) the time updates are more frequent and smoother to render.

This pull request replaces the current event. For backwards compatibility, maybe an additional option or callback should be better? Another library (react-audio-player) uses the onListen event for a more frequent update.

souporserious commented 8 years ago

@eborned sorry it's been forever on this. I'm finishing up a rewrite that should allow you to do this yourself. Thanks for your work on this, but for now I'd like to use the native event.

You should be able to do the same thing by using a reference to the player in the new build and then setting up an interval to check the current time.