Jump to content
Search Community

Thoughts on Keeping MP3Loader and VideoLoader in sync?

Wonder Giant
Moderator Tag

Recommended Posts

Posted

Hi all,

 

This may be more of a theoretical question. I need to pick someone else's brain since I have tried everything I can think of.

 

I am working on an app that has a video track (with audio), and then I need ANOTHER audio track to be playing on top of that (in sync). The purpose being that I need to be able to toggle the second audio track on/off

 

  • The video is in a VideoLoader.
  • The Audio is in an MP3Loader.
  • The are both set to autoPlay:false

 

 

When I am ready to show them I call:

// Sync the sound loader to wherever the video is
mySoundLoader.soundTime = myVideoLoader.videoTime;

// Play both files at once.
myVideoLoader.playVideo();
mySoundLoader.playSound();
 
Trouble is if one or the other lags at all, then they will be out of sync. So I wrote a function to check on it every once and a while and resync the two files, but that in itself causes a 'glitch' when it resyncs.
 
So overall I was wondering if there is some other magic way I do not know about to keep the two in better sync?
 
 
 
Posted

Not really sure what else to suggest. Your attempt to occasionally re-synch them seems like the best bet, and I'm not really sure how to do that without a little stutter. As far as I know it isn't possible to get perfect synchronization of separate video and audio.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...