Hi to all! Trying to get a clip to play in sync on two networked devices.
Here’s my script:
function SyncPlay(offset:int)
{
networkView.RPC ("Play", RPCMode.Others,offset);
audio.Play(offset);
}
@RPC
function Play(offset:int, info : NetworkMessageInfo)
{
var timeInTransit : float = Network.time-info.timestamp;
Debug.Log("timeInTransit : "+timeInTransit);
var newOffset : int = offset - 44100.0*timeInTransit;
Debug.Log("newOffset : "+newOffset);
audio.Play(newOffset);
}
I’m launching SyncPlay(44100) from a GUI button on a mac (which is the server), the connected device is an iPad. timeInTransit and newOffset Debug show absolutely coherent values (.1 s, newOffset 33000 for example), but the audio is not in sync (the server plays about .1s early).
Any ideas? Thanks!