Audio and visuals out of sync #2

Open
opened 2021-11-01 00:06:15 +01:00 by vlw · 1 comment
vlw commented 2021-11-01 00:06:15 +01:00 (Migrated from codeberg.org)

Starting playback will in 9/10 cases run the visuals too early, with the sound lagging behind.

Start when everything is ready, not when audio is ready

It's possible this is a race issue and HTMLMediaElement.play() can be called along with the first executing Monkeydo task to make them play together.

Time drift

It is however also quite possible this is related to setTimeout() drift. Which can be observed even with the audio and visuals in sync by simply placing the browser in the background or even triggering some work on the main thread.

If this happens to be the case, one solution could be to implement a current time "sync pulse" which will be emitted from a Monkeydo task (with some interval) containing the expected media currentTime for an adjacent task.
HTMLMediaElement.currentTime could be aligned with this pulse, but it might cause a lot of audio glitches.

**Starting playback will in 9/10 cases run the visuals too early, with the sound lagging behind.** ## Start when everything is ready, not when audio is ready It's possible this is a race issue and `HTMLMediaElement.play()` can be called along with the first executing Monkeydo task to make them play together. ## Time drift It is however also quite possible this is related to `setTimeout()` drift. Which can be observed even with the audio and visuals in sync by simply placing the browser in the background or even triggering some work on the main thread. If this happens to be the case, one solution could be to implement a current time "sync pulse" which will be emitted from a Monkeydo task (with some interval) containing the expected media `currentTime` for an adjacent task. `HTMLMediaElement.currentTime` could be aligned with this pulse, but it might cause a lot of audio glitches.
vlw commented 2022-01-21 13:25:56 +01:00 (Migrated from codeberg.org)

This has been fixed in Monkeydo 0.4.0

This has been fixed in [Monkeydo 0.4.0](https://github.com/VictorWesterlund/monkeydo/releases/tag/0.4.0)
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
vlw/still-alive#2
No description provided.