0
我在iPhone上的GKVoiceChat有問題。當我用iphone和ipad測試語音聊天時,ipad的輸出聲音通過揚聲器響亮而清晰,但當涉及到iphone輸出聲音時,我必須將它放在耳邊才能聽到聲音。IOS GKVoiceChat iphone
我可以選擇音頻輸出,以便我可以聽到來自揚聲器的聊天內容嗎?
- (void) establishChat
{
audioChat = YES;
chat = [activeMatch voiceChatWithName:@"com.fazan.chat"];
if (!chat)
{
NSLog(@"Error establishing chat!");
return;
}
chat.playerStateUpdateHandler = ^(NSString *playerID, GKVoiceChatPlayerState state) {
switch (state)
{
case GKVoiceChatPlayerSpeaking:
NSLog(@"***Speaking: %@", playerID);
// Highlight player's picture
break;
case GKVoiceChatPlayerSilent:
NSLog(@"***Silent: %@", playerID);
// Dim player's picture
break;
case GKVoiceChatPlayerConnected:
NSLog(@"***Connected: %@", playerID);
// Show player name/picture
break;
case GKVoiceChatPlayerDisconnected:
NSLog(@"***Disconnected: %@", playerID);
// Hide player name/picture
break;
} };
chat.active = NO; // disable mic by setting to NO
chat.volume = 1.0f; // adjust as needed.
NSLog(@"Connecting to channel");
[chat start]; // stop with [chat end];
NSLog(@"Chat: %@", chat.description);
NSLog(@"Participants: %@", chat.playerIDs);
// Establishing team chats and direct chat
/*
e.g. directChat = [match voiceChatWithName:@"Private Channel 1"];
Each unique name specifies the chat
*/
// muting: [chat setMute:YES/NO forPlayer: playerID];
}