Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug introduced when adding video replays in #579 that was making the timer freeze and sometimes show negative values during rewind.
The issue was caused by updating only the video player's current time and not propagating the change to the element rendering the overlay. We've seemed to rely on
handleTimeUpdate
callback registered on"timeupdate"
event, but this event is not emitted when updating the current time of the video programmatically.Sometimes, the timer indicated negative values during rewind, and this was also caused by setting the current time on video without updating the overlay's
time
accordingly, which in turn led totime = 0
(default on mount) andstartTime = [video duration - 5]
, causing the timer to show negative values whenvideo duration > 5
(we calculate the time displayed on timer astime - startTime
).The proposed changes include passing a callback that allows the rewind function not only for updating the video's current time, but also the current time of the overlay component.
Another change is that we won't show
• REPLAY 0:00
until video metadata is loaded to avoid flickering from0:00
tovideo duration
when starting the rewind.main.mov
new.mov
How Has This Been Tested:
Tested that with introduced changes, the timer behaves as expected both in rewind and normal playback.