captbaritone / captbaritone/webamp
Timeupdate event is not fired consistently
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 796
- PR merge metrics
- No merged PRs in 30d
Description
I noticed this some time ago when opening the #498.
Sometimes it gets fired after roughly 250ms and sometimes after roughly 500ms. This means the Time doesn't get updated precisely every 1 second - and with it also the seeking bar. E.g. timeElapsed is set to 3.0, 3.5, 3.75, 4.25 (so it's late 250ms - took 1.25s to change from 3), 4.75, 5.0 (so it's early 250ms - took 0.75s to change from 4). This means it doesn't look very smooth.
The question would be how to replace it. Maybe it would make sense to `setInterval(dispatch UPDATE_TIME_ELAPSED media.timeElapsed(), 250)` when playing and clear it on stop. What I don't like is that it doesn't have to happen at the beginning of the frame. Meaning if it gets fired at the end of a frame, we may delay it. On the other hand, I can't imagine how requestAnimationFrame could be used.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading issue #498 and tracing the playback path that dispatches the Timeupdate event and updates the seeking bar. Compare the observed 250ms and 500ms timing behavior with the proposed setInterval and requestAnimationFrame approaches. Done means elapsed time and the seeking bar update consistently without the reported timing jumps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- audio-video-rtc, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100