iOS Developer Library

Developer

GameKit Framework Reference GKVoiceChatService Class Reference

Options
Deployment Target:

On This Page
Language:

GKVoiceChatService

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

Inheritance


Conforms To


Import Statement


import GameKit @import GameKit;

Availability


Available in iOS 3.0 and later.
Deprecated in iOS 7.0.
  • Returns whether voice chat is allowed to be used on the device.

    Declaration

    Objective-C

    + (BOOL)isVoIPAllowed

    Return Value

    YEStrue if voice chat is available to the application.

    Discussion

    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.

    Import Statement

    Availability

    Available in iOS 4.1 and later.

    Deprecated in iOS 7.0.

  • Retrieves the singleton chat service.

    Declaration

    Objective-C

    + (GKVoiceChatService *)defaultVoiceChatService

    Return Value

    The chat service.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • client client (iOS 7.0) Property

    An object that the voice chat service uses to communicate with remote participants.

    Declaration

    Objective-C

    @property(assign) id< GKVoiceChatClient > client

    Discussion

    The client’s chief responsibility is to provide a network connection that the voice chat service can use to connect to another participant.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • Sends a request to another participant to join the voice chat.

    Declaration

    Objective-C

    - (BOOL)startVoiceChatWithParticipantID:(NSString *)participantID error:(NSError **)error

    Parameters

    participantID

    A string that uniquely identifies the participant to connect to.

    error

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

    Return Value

    YEStrue if the connection was successfully created.

    Discussion

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

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • microphoneMuted microphoneMuted (iOS 7.0) Property

    A Boolean value that determines whether the user’s microphone is muted.

    Declaration

    Objective-C

    @property(nonatomic, getter=isMicrophoneMuted) BOOL microphoneMuted

    Discussion

    YEStrue if the user’s microphone is turned off; NOfalse if the user’s speech is being transmitted to remote participants. The default is NOfalse.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • A float that scales the volume of all remote participants.

    Declaration

    Objective-C

    @property(nonatomic) float remoteParticipantVolume

    Discussion

    The value should be between 0.0 (muted) and 1.0 (full volume). The default is 1.0.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • A Boolean value that indicates whether the microphone’s sound level is being monitored.

    Declaration

    Objective-C

    @property(nonatomic, getter=isInputMeteringEnabled) BOOL inputMeteringEnabled

    Discussion

    If YEStrue, your application can read the inputMeterLevel property to monitor the sound level of the microphone. If NOfalse, the value of the inputMeterLevel property is undefined. Default is NOfalse. When your application doesn’t need to monitor the microphone, it should set this property to NOfalse to improve performance.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

    See Also

    inputMeterLevel

  • inputMeterLevel inputMeterLevel (iOS 7.0) Property

    The volume, in decibels (db), being received by the microphone. (read-only)

    Declaration

    Objective-C

    @property(readonly) float inputMeterLevel

    Discussion

    The value of this property is undefined if inputMeteringEnabled is set to NOfalse.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • A Boolean value that indicates whether the voice level of remote participants is monitored.

    Declaration

    Objective-C

    @property(nonatomic, getter=isOutputMeteringEnabled) BOOL outputMeteringEnabled

    Discussion

    If YEStrue, your application can read the outputMeterLevel property to monitor sound level of remote participants. If NOfalse, the value of the outputMeterLevel property is undefined. Default is NOfalse. When your application doesn’t need to monitor remote participants, it should set this property to NOfalse to improve performance.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • outputMeterLevel outputMeterLevel (iOS 7.0) Property

    The volume, in decibels (db), being received from all other participants. (read-only)

    Declaration

    Objective-C

    @property(readonly) float outputMeterLevel

    Discussion

    The value of this property is undefined if outputMeteringEnabled is set to NOfalse.

    The volume level is the aggregate volume of all remote participants, modified by the remoteParticipantVolume property.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • Accepts a request from a remote user to establish a voice chat.

    Declaration

    Objective-C

    - (BOOL)acceptCallID:(NSInteger)callID error:(NSError **)error

    Parameters

    callID

    An integer that identifies the connection request.

    error

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

    Return Value

    YEStrue if the connection was established; otherwise NOfalse.

    Discussion

    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.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • Rejects a request to establish a voice chat.

    Declaration

    Objective-C

    - (void)denyCallID:(NSInteger)callID

    Parameters

    callID

    An integer that identifies the connection request.

    Discussion

    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.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • Called by the client to deliver new data received from a remote participant.

    Declaration

    Objective-C

    - (void)receivedData:(NSData *)arbitraryData fromParticipantID:(NSString *)participantID

    Parameters

    arbitraryData

    The data received from a participant.

    participantID

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

    Discussion

    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.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • Called by the client to deliver voice data received from a remote participant..

    Declaration

    Objective-C

    - (void)receivedRealTimeData:(NSData *)audio fromParticipantID:(NSString *)participantID

    Parameters

    audio

    The audio data that was received from the other participant.

    participantID

    A string that uniquely identifies the speaking participant.

    Discussion

    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.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.

  • The GKVoiceChatService error domain.

    Declaration

    Swift

    let GKVoiceChatServiceErrorDomain: NSString!

    Objective-C

    NSString * const GKVoiceChatServiceErrorDomain;

    Constants

    • GKVoiceChatServiceErrorDomain

      GKVoiceChatServiceErrorDomain

      An error occurred in GKVoiceChatService.

      Available in iOS 3.0 and later.

    Import Statement

  • Error codes for the GKVoiceChatService error domain.

    Declaration

    Objective-C

    typedef enum { GKVoiceChatServiceInternalError = 32000, GKVoiceChatServiceNoRemotePacketsError = 32001, GKVoiceChatServiceUnableToConnectError = 32002, GKVoiceChatServiceRemoteParticipantHangupError = 32003, GKVoiceChatServiceInvalidCallIDError = 32004, GKVoiceChatServiceAudioUnavailableError = 32005, GKVoiceChatServiceUninitializedClientError = 32006, GKVoiceChatServiceClientMissingRequiredMethodsError = 32007, GKVoiceChatServiceRemoteParticipantBusyError = 32008, GKVoiceChatServiceRemoteParticipantCancelledError = 32009, GKVoiceChatServiceRemoteParticipantResponseInvalidError = 32010, GKVoiceChatServiceRemoteParticipantDeclinedInviteError = 32011, GKVoiceChatServiceMethodCurrentlyInvalidError = 32012, GKVoiceChatServiceNetworkConfigurationError = 32013, GKVoiceChatServiceUnsupportedRemoteVersionError = 32014, GKVoiceChatServiceOutOfMemoryError = 32015, GKVoiceChatServiceInvalidParameterError = 32016 } GKVoiceChatServiceError;

    Constants

    • GKVoiceChatServiceInternalError

      GKVoiceChatServiceInternalError

      A serious error occurred inside the voice chat service.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceNoRemotePacketsError

      GKVoiceChatServiceNoRemotePacketsError

      The voice chat service stopped receiving packets from the remote participant.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceUnableToConnectError

      GKVoiceChatServiceUnableToConnectError

      The voice chat service was unable to establish a connection with another user.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceRemoteParticipantHangupError

      GKVoiceChatServiceRemoteParticipantHangupError

      The remote participant in a voice chat stopped the chat.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceInvalidCallIDError

      GKVoiceChatServiceInvalidCallIDError

      The voice chat service didn’t recognize the call identifier.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceAudioUnavailableError

      GKVoiceChatServiceAudioUnavailableError

      The audio hardware is unavailable to the voice chat service.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceUninitializedClientError

      GKVoiceChatServiceUninitializedClientError

      The application did not set a client before calling voice chat service methods.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceClientMissingRequiredMethodsError

      GKVoiceChatServiceClientMissingRequiredMethodsError

      The voice chat service did not find an expected method defined by the client.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceRemoteParticipantBusyError

      GKVoiceChatServiceRemoteParticipantBusyError

      The remote participant is already connected to a voice chat.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceRemoteParticipantCancelledError

      GKVoiceChatServiceRemoteParticipantCancelledError

      A remote participant attempted to start a voice chat, then canceled.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceRemoteParticipantResponseInvalidError

      GKVoiceChatServiceRemoteParticipantResponseInvalidError

      Invalid data was received from a remote participant.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceRemoteParticipantDeclinedInviteError

      GKVoiceChatServiceRemoteParticipantDeclinedInviteError

      A remote participant declined an invitation.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceMethodCurrentlyInvalidError

      GKVoiceChatServiceMethodCurrentlyInvalidError

      A method on the voice chat service was called when it was not allowed to be called (for example, attempting to connect when the voice chat service was already connected).

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceNetworkConfigurationError

      GKVoiceChatServiceNetworkConfigurationError

      The voice chat service had problems accessing the network.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceUnsupportedRemoteVersionError

      GKVoiceChatServiceUnsupportedRemoteVersionError

      The other participant is running a different version of the voice chat service.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceOutOfMemoryError

      GKVoiceChatServiceOutOfMemoryError

      The voice chat service was unable to allocate memory required to operate.

      Available in iOS 3.0 and later.

    • GKVoiceChatServiceInvalidParameterError

      GKVoiceChatServiceInvalidParameterError

      A parameter had an unrecognized value.

      Available in iOS 3.0 and later.

    Import Statement

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 7.0.