A GKVoice​Chat object provides a voice channel that allows a set of players in a match to speak with each other.


In an iOS game, before you can use voice chat, your game must configure an audio session that allows for both play and recording (k​Audio​Session​Category_Play​And​Record). For more information on audio sessions, see Audio Session Programming Guide.

You use the GKMatch object to create a voice chat channel by calling its voice​Chat(with​Name:​) method, passing in a string that identifies the name of the channel you want to join. The name is never displayed by GameKit, and you are free to name the channels however you like. You can create multiple channels for the same match. For example, if the match has multiple teams, you might create a separate channel for each team, and an additional channel that holds all of the players in the match.

To connect a player to a channel, call the voice chat object’s start() method. After a channel is started, it receives voice data from other players already in the channel. To allow the player to speak in a channel, set the voice chat object’s is​Active property to true. A player can listen to multiple channels simultaneously but may only speak on one channel at any given time.

Your game uses the volume property to set the volume level for an entire channel, and the set​Player(_:​muted:​) method to selectively mute other players in the channel.

If there is insufficient bandwidth over wi-fi to maintain a voice chat, GameKit may disconnect individual players from the channel or disband the channel entirely.


Determining Whether Voice Chat Is Available

class func is​Vo​IPAllowed()

Returns whether voice chat may be used on the device.

Starting and Stopping Voice Chat

func start()

Starts communication with other participants in a channel.

func stop()

Ends communication with the channel.

Transmitting to Other Players

var is​Active:​ Bool

A Boolean value that states whether the channel is sampling the microphone.

Receiving Updates About Other Participants


The states returned to your game about other players in a voice chat.

Controlling Chat Volume

func set​Player(GKPlayer, muted:​ Bool)

Mutes a participant in the chat.

var volume:​ Float

The volume level for the voice channel.

Channel Properties

var name:​ String

The name of the voice chat

var players:​ [GKPlayer]

An array of GKPlayer objects containing the player identifiers for the players connected to the channel.

Deprecated Methods and Properties

var player​IDs:​ [String]

An array of NSString objects containing the player identifiers for the players connected to the channel.

var player​State​Update​Handler:​ (String, GKVoice​Chat​Player​State) -> Void

A block that is called when a participant changes state.

func set​Mute(Bool, for​Player:​ String)

Mutes a participant in the chat.



Inherits From