Start playing 2 AV resources at exactly the same time

I have an mp4 video that needs to be played together (in sync) with multiple different mp3 audios (exactly one mp4 + one mp3 playing at any given time).

However, there’s no guarantee way to start the video and audio at the exact same time as playAsync is asynchronous (and keep them in sync after pauseAsync etc).

The more reliable way is to combine the mp3s with the mp4 beforehand, but that means the user needs to download multiple mp4s instead of 1 mp4 and multiple mp3s (which is way smaller, so less storage & data usage).

Is there any better way to resolve this?

@sjchmiela Do you know what the best course of action would be here?

It’s virtually impossible to achieve this behavior with 100%-alignment right now without having to download separate pre-mixed videos. :disappointed:

An ideal solution would probably involve one AV file with more then one audio track and changing the playing one during play (unsupported at the moment). This would be the most reusable solution (although in your situation would involve having to reencode the file with something like ffmpeg to have one file with all the tracks inside). I’ll look into this in spare time and in the meantime you could post either an issue on Github or a feature request on Expo Canny. :slightly_smiling_face: (I don’t know which would be more appropriate.)

Thanks for the response!

Why would that be the most “reusable” solution?

Supposed I want to play an mp3 that was recorded by the user together with an mp4, I’d need the send the mp3 to the server, re-encode the mp4 with it, and send the mp4 back.

The better fix in this case would be to allow the AV API to accept multiple AV sources, which will be played in sync.

This use case is likely uncommon though, so if your solution is a lot simpler to implement it might be better to have that first.

Yeah, I thought it’s more likely that someone would like to play a multitrack video with language selector rather than try to sync two AV sources… I’ll see what I can come up with regarding the multitrack files.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.