I'm developing a stream player, I decided to turn off the audio of the video and create individual audios with the languages (audios separately) but the audio never sync. See below:
• Synchronizing the audio based on the video (I'm using the playing event, because timeupdate and progress don't work very well)
video.onplaying = function(){ audio.currentTime = Math.round(video.currentTime)}
• Getting the difference between the currentTime of the audio and the video (if it is synchronized)
video.ontimeupdate = function () {
document.title = video.currentTime - audio.currentTime; // it oscillates between 0.0535555 and 0.0756795 (Not synchronized)
}
I know it seems to want a lot, because I delay it and very little, but there is a way to sync perfectly. (I don't know how the big streams do to get all the languages but this was the personal way I found to solve this)