谁能告诉我如何在iphone sdk中实现语音。游戏是用来通过蓝牙进行语音聊天的。我希望我的应用程序具有互联网上的语音聊天选项
谢谢Yasir
发布于 2010-12-17 06:35:53
苹果的GameKit框架提供了你在游戏中实现聊天所需的一切。
完整的文档在这里:
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/AddingVoiceChattoaMatch/AddingVoiceChattoaMatch.html#//apple_ref/doc/uid/TP40008304-CH11-SW11
假设您已经使用GameKit将应用程序连接到一个或多个其他播放器,您可以这样开始语音聊天:
-(void) startInGameChat {
//Set up audio session
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:myErr];
[audioSession setActive: YES error: myErr];
GKMatch* match;
GKVoiceChat *teamChannel = [[match voiceChatWithName:@"redTeam"] retain];
GKVoiceChat *allChannel = [[match voiceChatWithName:@"allPlayers"] retain];
//Start the chat
[teamChannel start];
//Enable Mic
teamChannel.active = YES;
}
发布于 2013-07-26 17:40:36
最好的方法是使用XMPP框架。使用XMPP,您可以向其他人发送文件和文本。使用它,您可以录制语音消息并将其发送过去。为了在ios上用XMPP协议实现jabber服务器,我做了大量的研发工作。
有关更多信息,请转到链接:使用XMPP协议实现jabber。
http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-server-setup/
你也可以在ios中看到这个简单聊天的链接:http://www.ibm.com/developerworks/library/x-ioschat/
https://stackoverflow.com/questions/4465811
复制相似问题