Class: GKVoiceChat
Overview
A GKVoiceChat object provides a voice channel that allows a set of players in a match to speak with each other.
Instance Attribute Summary (collapse)
-
- active
A Boolean value that states whether the channel is sampling the microphone.
-
- name
readonly
The name of the voice chat (read-only).
-
- playerIDs
readonly
An array of player identifiers for the players connected to the channel.
-
- volume
The volume level for the voice channel.
Class Method Summary (collapse)
-
+ isVoIPAllowed
Returns whether voice chat may be used on the device.
Instance Method Summary (collapse)
-
- setMute:forPlayer:
Mutes a participant in the chat.
-
- start
Starts communication with other participants in a channel.
-
- stop
Ends communication with the channel.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (Boolean) active
A Boolean value that states whether the channel is sampling the microphone. When active is YES, the voice chat samples the microphone and transmits the voice data to other players connected to the channel. Default value is NO.Only one GKVoiceChat object is allowed to sample the microphone at any given time. When your game sets the active property to YES on a voice chat object, the previous voice chat object that owned the microphone (if there was one) sets its active property to NO.
- (String) name (readonly)
The name of the voice chat (read-only)
- (Array) playerIDs (readonly)
An array of player identifiers for the players connected to the channel. (read-only)
- (Float) volume
The volume level for the voice channel. All voice data received from other participants is mixed and then scaled by the volume property. The volume property has a range between 0.0 and 1.0, inclusive. A volume level of 0.0 means the entire channel is muted; a value of 1.0 plays voice samples at full volume. The default value is 1.0.
Class Method Details
+ (Boolean) isVoIPAllowed
Returns whether voice chat may be used on the device. Some countries or phone carriers may restrict the availability of voice over IP services. Before creating a GKVoiceChat object, your game should first check to see whether voice over IP is permitted on the device.
Instance Method Details
- (Object) setMute(isMuted, forPlayer:player)
Mutes a participant in the chat. When a player is muted, the local player does not hear voice data transmitted by that player.
- (Object) start
Starts communication with other participants in a channel. When start is called, the voice chat object connects to the channel and notifies other players connected to the channel that the local player joined the chat. While connected, voice data from other players is played automatically. If the player is connected to the channel and the voice chat object’s active property is YES, then the microphone is sampled and the data sent to the channel.A device only connects to a channel when the device has a microphone and is connected via wi-fi. However, your game may configure and start a voice chat channel when the device is not currently capable of using voice chat. If conditions change to allow voice chat—for example, the device connects to a wi-fi network—the GKVoiceChat object then automatically connects to the channel.
- (Object) stop
Ends communication with the channel. When stop is called, the voice chat object disconnects from the channel. You should call stop on a channel before the voice chat object is disposed.