Please sign in to comment.
fix: don't throttle duration change updates (#4635)
Right now the durationchange event is throttled with the other two events, timeupdate and loadedmetadata. This means that only one of those events will trigger an update if they all occur within 25ms of each other. This functionality makes sense for timeupdate or loadedmetadata as those should not indicate a time update (even though they often do). For durationchange however it will always indicate a change in the duration, and we want to always update the display when it happens. Here is a scenario of how we could show duration incorrectly right now: User is playing a video that has a postroll ad at the end. After the postroll ad their will be a timeupdate, and then a durationchange to signify that we are back in content. Then ended will fire, and no more events will happen. The player will still show the duration of the ad, as the durationchange was eaten by the timeupdate that happened at nearly the same time. Also, fix a potential issue where if the page was translated using google translate, the time displays stopped updating.
- Loading branch information...
Showing with 18 additions and 16 deletions.