GKVoiceChat
A voice channel that allows players to speak with each other in a multiplayer game.
Declaration
class GKVoiceChatMentioned in
Overview
GameKit provides the underlying mechanism to implement voice chat between players in a multiplayer game. It’s your responsibility to provide player controls and display feedback during the chat.
First, configure voice chat by adding the NSMicrophoneUsageDescription key to the Information Property List and creating an audio session. Then, create a GKVoiceChat object using the GKMatch voiceChat(withName:) method passing a string that identifies the voice channel. Use the start() method to connect players to the channel. Use the isActive property to activate the microphone or switch the microphone between channels.
Provide a handler using the playerVoiceChatStateDidChangeHandler property to update the interface when a player connects, speaks, or disconnects from a chat. You can also add controls that mute and set the volume using the setPlayer(_:muted:) method and volume property.
Note that if there’s insufficient bandwidth over Wi-Fi to maintain a voice chat, GameKit may disconnect players from the channel or disband a channel.
Topics
Determining Whether Voice Chat Is Available
Starting and Stopping Voice Chat
Receiving Updates About Other Participants
Controlling Chat Volume
Accessing Properties
Deprecated Methods and Properties
See Also
Deprecated classes
GKAchievementViewControllerGKChallengeEventHandlerGKChallengesViewControllerGKChallengeGKScoreChallengeGKAchievementChallengeGKCloudPlayerGKGameCenterViewControllerGKGameSessionGKGameSessionSharingViewControllerGKFriendRequestComposeViewControllerGKLeaderboardViewControllerGKPeerPickerControllerGKScoreGKSession