0

I added voice chat to my iOS app using GameKit connection as a base and the delay in transmission (over bluetooth) appears to be about 4 seconds, which translates to 8 seconds to receive a reply to a question.

While I'm not entirely sure what is causing such large delay, I have a couple of suspects.

First, I noticed that it's using a method voiceChatService:sendData:toParticipantID: from GKVoiceChatClient while there is also voiceChatService:sendRealTimeData:toParticipantID: available. Yet I do not see any obvious way to make it use RealTimeData version of the method instead, even if I implement it. How can I do that and is it likely to help?

Also, I changed the data mode to GKSendDataUnreliable as with GKSendDataReliable I would sometimes hear the same thing twice as the app likely re-sent the unconfirmed bits. This removed the echo-like effect, but did not improve the lag.

What else can I do to improve real time performance?

SaltyNuts
  • 5,068
  • 8
  • 48
  • 80

1 Answers1

0

Well, I have since figured out what the problem is. The relevant item to change is:

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setMode: AVAudioSessionModeVoiceChat error:NULL];

The VoiceChat mode makes the lag dramatically smaller, similar to what I experience when having a cell phone conversation.

SaltyNuts
  • 5,068
  • 8
  • 48
  • 80