Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: videojs#5937 Issue originally found and explained by meikidd, see: videojs#5937 (comment) Add requestAnimationFrame (RAF) flag to prevent RAF calls from stacking in background This component's `update` method is called via a `setInterval` which runs when a tab is in the background. Since `update` is continuously called, RAF calls are made each tick, but RAF does not fire in the background. RAF calls stack while tab is in the background and will fire immediately when tab regains focus. This causes a potentially huge number of RAF calls to attempt to immediately execute when tab regains focus, which can potentially lock up a tab entirely until all queued RAF's finish firing. To prevent this issue, we can use a variable to track when an RAF call is made, and prevent additional calls from being made until the last queued RAF function executes.
- Loading branch information