Synchronization of video with audio

Hello,
I am trying to synchronize video with audio. Inspired by @RaananW 's solution to synchronize two videos using onseeking callback, I tried to do something similar with audio - have a callback in audio to drive video. Here is @RaananW 's video synchronization solution

However, sound class does not have onseeking . What would be the best way to sync a video texture with a playing audio?
thank you

the babylon video element doesn’t have onseeking as well. it’s the underlying HTML element that has them.

And in case of a sound, we don’t expose the HTML element that is playing the audio, because it is usually not an HTML element.
We could see if we add a setter to the currentTime (which is currently only a getter). Otherwise, you could add an HTMLAudioElement yourself and synchronize it just like the video. But then you will not be using Babylon’s classes and will lose the benefits of audio integration. If you don’t need the babylon functionality, you can use pure HTML.

1 Like

thank you @RaananW
I realized that another relatively simple way to make audio be more in sync with video is to use timers. Every second (or another time period, depending how accurate you want to be), we can read current time of the audio and set the video’s current time to the same time

Yes. or provide a video with audio in it already :slight_smile:

I try to avoid this option as much as I can since our video clips are dubbed into about 10 languages.

1 Like