Class: GKVoiceChatService

Inherits:
NSObject show all

Overview

The GKVoiceChatService class allows your application to connect two iOS devices into a voice chat.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

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

- (Object) client

An object that the voice chat service uses to communicate with remote participants. The client’s chief responsibility is to provide a network connection that the voice chat service can use to connect to another participant.

Returns:

- (Boolean) inputMeteringEnabled

A Boolean value that indicates whether the microphone’s sound level is being monitored. If YES, your application can read the inputMeterLevel property to monitor the sound level of the microphone. If NO, the value of the inputMeterLevel property is undefined. Default is NO. When your application doesn’t need to monitor the microphone, it should set this property to NO to improve performance.

Returns:

  • (Boolean)

- (Float) inputMeterLevel (readonly)

The volume, in decibels (db), being received by the microphone. (read-only) The value of this property is undefined if inputMeteringEnabled is set to NO.

Returns:

- (Boolean) microphoneMuted

A Boolean value that determines whether the user’s microphone is muted. YES if the user’s microphone is turned off; NO if the user’s speech is being transmitted to remote participants. The default is NO.

Returns:

  • (Boolean)

- (Boolean) outputMeteringEnabled

A Boolean value that indicates whether the voice level of remote participants is monitored. If YES, your application can read the outputMeterLevel property to monitor sound level of remote participants. If NO, the value of the outputMeterLevel property is undefined. Default is NO. When your application doesn’t need to monitor remote participants, it should set this property to NO to improve performance.

Returns:

  • (Boolean)

- (Float) outputMeterLevel (readonly)

The volume, in decibels (db), being received from all other participants. (read-only) The value of this property is undefined if outputMeteringEnabled is set to NO.The volume level is the aggregate volume of all remote participants, modified by the remoteParticipantVolume property.

Returns:

- (Float) remoteParticipantVolume

A float that scales the volume of all remote participants. The value should be between 0.0 (muted) and 1.0 (full volume). The default is 1.0.

Returns:

Class Method Details

+ (GKVoiceChatService) defaultVoiceChatService

Retrieves the singleton chat service.

Returns:

+ (Boolean) isVoIPAllowed

Returns whether voice chat is allowed to be used on the device. Some countries or phone carriers may restrict the availability of voice over IP services. Before retrieving the shared voice chat service object, your application should check to see whether voice chat is available.

Returns:

  • (Boolean)

    YES if voice chat is available to the application.

Instance Method Details

- (Boolean) acceptCallID(callID, error:error)

Accepts a request from a remote user to establish a voice chat. When a remote user requests a voice chat, the voice chat service calls the client’s voiceChatService:didReceiveInvitationFromParticipantID:callID: method. The client calls this method to accept the request or denyCallID: to reject it.

Parameters:

  • callID (Integer)

    An integer that identifies the connection request.

  • error (Pointer)

    If an error occurs, upon return contains an NSError object that describes the problem. Pass NULL if you do not want error information.

Returns:

  • (Boolean)

    YES if the connection was established; otherwise NO.

- (Object) denyCallID(callID)

Rejects a request to establish a voice chat. When a remote user requests a voice chat, the voice chat service calls the client’s voiceChatService:didReceiveInvitationFromParticipantID:callID: method. The client calls this method to reject the request or acceptCallID:error: to accept it.

Parameters:

  • callID (Integer)

    An integer that identifies the connection request.

Returns:

- (Object) receivedData(arbitraryData, fromParticipantID:participantID)

Called by the client to deliver new data received from a remote participant. The voice chat service uses a network connection provided by the client to exchange information between the participants. When the client receives information intended for the voice chat service, it should call this method to transfer it.

Parameters:

  • arbitraryData (NSData)

    The data received from a participant.

  • participantID (String)

    A string that uniquely identifies the participant who sent the data.

Returns:

- (Object) receivedRealTimeData(audio, fromParticipantID:participantID)

Called by the client to deliver voice data received from a remote participant.. The voice chat service uses a network connection provided by the client to exchange information between the participants. When the client receives information intended for the voice chat service, it should call this method to transfer it.

Parameters:

  • audio (NSData)

    The audio data that was received from the other participant.

  • participantID (String)

    A string that uniquely identifies the speaking participant.

Returns:

- (Boolean) startVoiceChatWithParticipantID(participantID, error:error)

Sends a request to another participant to join the voice chat. The voice chat service calls the client’s voiceChatService:sendData:toParticipantID: method to send the connection request to the remote participant.

Parameters:

  • participantID (String)

    A string that uniquely identifies the participant to connect to.

  • error (Pointer)

    If an error occurs, upon return contains an NSError object that describes the problem. Pass NULL if you do not want error information.

Returns:

  • (Boolean)

    YES if the connection was successfully created.

- (Object) stopVoiceChatWithParticipantID(participantID)

Ends a previously established voice chat. When this method is called, the client’s voiceChatService:didStopWithParticipantID:error: method is called.

Parameters:

  • participantID (String)

    A string that uniquely identifies the participant in the chat.

Returns: