Quote:
Originally Posted by vincefried
Hey there,
following problem: I have an app, that starts a sound on two devices, connected over p2p. I want to start the sounds at the same time. I tried to do that over p2p, and it works, but there's a little latency between the starts. Is there any way to let one device wait for the other, so that the two devices could start the sound at the same time?
Sincerely,
vincefried
|
The big problem with latency is that it can vary from message to message. That makes it hard to get good synchronization between devices over a network.
Assuming the clocks on the two devices are synchronized, send an NSTimeInterval that represents a time in the near future. Use that to start a timer on both machines. When the timer goes off, play the sound on both devices.