PlanetKitAudioSpkControllable

@objc
public protocol PlanetKitAudioSpkControllable

A class that represents the audio speaker management for PlanetKit.

  • Indicates whether the VoiceProcessingIO is enabled.

    Remark

    This value will be modified during call setup by our service configuration. If you want to override our suggested configuration, you should call withIgnoreVpioServiceConfigKey(ignore:).

    Declaration

    Swift

    var vpioEnabled: Bool { get set }
  • Indicates whether the speaker is enabled.

    Declaration

    Swift

    var spkEnabled: Bool { get set }
  • Indicates whether the speaker is opened.

    Declaration

    Swift

    var isOpened: Bool { get }
  • Indicates whether the speaker is started.

    Declaration

    Swift

    var isStarted: Bool { get }
  • Opens the speaker.

    Declaration

    Swift

    func open()
  • Starts the speaker.

    Declaration

    Swift

    func start()
  • Stops the speaker.

    Declaration

    Swift

    func stop()
  • Closes the speaker.

    Declaration

    Swift

    func close()
  • Executes an asynchronous closure using the internal audio queue.

    Declaration

    Swift

    func async(completion: @escaping () -> Void)
  • Indicates whether the speakerphone is enabled.

    Declaration

    Swift

    var isSpeakerOut: Bool { get }
  • Enables or disables the speakerphone.

    Declaration

    Swift

    func speakerOut(_ out: Bool)

    Parameters

    out

    A Boolean value indicating whether the speakerphone is enabled.

  • Sets the category and options for the audio session.

    Declaration

    Swift

    func setCategory(_ category: AVAudioSession.Category, options: AVAudioSession.CategoryOptions)

    Parameters

    category

    The category of the audio session.

    options

    The options for the audio session category.

  • Sets the mode for the audio session.

    Declaration

    Swift

    func setMode(_ mode: AVAudioSession.Mode)

    Parameters

    mode

    The mode of the audio session.

  • Sets the preferred audio route for the speaker playback.

    Declaration

    Swift

    func setPreferredAudioRoute(_ route: PlanetKitAudioRoute)

    Parameters

    route

    The preferred audio route for the speaker playback.

  • Represents the currently used speaker device.

  • Provides device type information to PlanetKit, indicating if it is a real device or a virtual device.

    Remark

    If this device instance is a virtual device, meaning it does not use a physical audio microphone, then isVirtualDevice should return true. It should return false when your custom device uses PlanetKit’s default audio device like PlanetKitAudio.spk or PlanetKitAudio.mic without changing the system’s default device.

    This value will affect the reset of VQE (Voice Quality Enhancement) if this device is a real device.

    Declaration

    Swift

    var isVirtualDevice: Bool { get }
  • Adds a receiver for the speaker playback.

    Declaration

    Swift

    func addSpkReceiver(_ spkReceiver: PlanetKitAudioSpkPlayDelegate)

    Parameters

    spkReceiver

    The receiver for the speaker playback.

  • Removes a receiver for the speaker playback.

    Declaration

    Swift

    func removeSpkReceiver(_ spkReceiver: PlanetKitAudioSpkPlayDelegate)

    Parameters

    spkReceiver

    The receiver for the speaker playback.

  • Sets the modifier for the speaker playback.

    Declaration

    Swift

    weak var spkModifier: PlanetKitAudioSpkPlayDelegate? { get set }
  • Sets the private delegate for the speaker playback.

    Remark

    The spkPrivateDelegate is primarily used by PlanetKitCall or PlanetKitConference to receive audio data from Planet Cloud and provide data for speaker playback.

    Declaration

    Swift

    weak var spkPrivateDelegate: PlanetKitAudioSpkPlayDelegate? { get set }
  • Sets the receiver for the speaker volume level.

    Remark

    The spkVolumeReceiver is used to receive the speaker volume level at every spkVolumeInterval seconds. The volume level ranges between 0.0 and 1.0.

    Declaration

    Swift

    weak var spkVolumeReceiver: PlanetKitAudioDeviceVolumeDelegate? { get set }
  • The interval at which the speaker volume level is received.

    Remark

    The spkVolumeReceiver will receive the speaker volume level at every spkVolumeInterval seconds. The volume level ranges between 0.0 and 1.0.

    Declaration

    Swift

    var spkVolumeInterval: TimeInterval { get set }
  • Plays an audio file.

    Declaration

    Swift

    func playFile(fileResourceUrl: URL, type: String, loopCount: Int32)

    Parameters

    fileResourceUrl

    The URL of the audio file to be played.

    type

    The identifier type of the audio file.

    loopCount

    The number of times the audio file should be played.

  • Plays an audio file.

    Declaration

    Swift

    func playFile(fileResourceUrl: URL, type: String, loopCount: Int32, completion: @escaping (Bool) -> Void)

    Parameters

    fileResourceUrl

    The URL of the audio file to be played.

    type

    The identifier type of the audio file.

    loopCount

    The number of times the audio file should be played.

    completion

    A closure that is called when the audio file playback is completed.

  • Stops the audio file playback.

    Declaration

    Swift

    func playStop(type: String)

    Parameters

    type

    The identifier type of the audio file.