SinchAudioController
public final class SinchAudioController
Undocumented
-
The object that acts as the delegate of the audio controller.
The delegate object handles audio related state changes.
See also
SinchAudioControllerDelegateDeclaration
Swift
public weak var delegate: SinchAudioControllerDelegate? { get set } -
Use this method to override the default AVAudioSessionCategoryOptions that will be set for the duration of phone calls. The selected options will be set for each call starting after the method invocation.
Declaration
Swift
public func setAudioSessionCategoryOptions(_ options: AVAudioSession.CategoryOptions) -
Mute the microphone.
Declaration
Swift
public func mute() -
Unmute the microphone.
Declaration
Swift
public func unmute() -
Route the call audio through the speaker.
Note that if this method is invoked at a moment when no established call exists, the current AVAudioSession configuration might be affected.
This method will affect AVAudioSessionCategoryOptions during the calls even if custom options have been set via
SINAudioController.setAudioSessionCategoryOptions(_:).See also
SinchCall.State.establishedDeclaration
Swift
public func enableSpeaker() -
Route the call audio through the handset earpiece.
Note that if this method is invoked at a moment when no established call exists, the current AVAudioSession configuration might be affected.
This method will affect AVAudioSessionCategoryOptions during the calls even if custom options have been set via
SINAudioController.setAudioSessionCategoryOptions(_:).See also
SinchCall.State.establishedDeclaration
Swift
public func disableSpeaker() -
Play a sound file, for the purpose of playing ringtones, etc.
This is a simple convenience method for playing sounds associated with a call, such as ringtones. It can only play one sound file at a time.
Note that if your app integrates with CallKit, the preferred way to specify the ringtone for an incoming audio call is via
ringtoneSoundproperty of CXProviderConfiguration.For advanced audio, apps that use the SDK should implement their own methods for playing sounds.
Regardless of whether a sound is looping or not, a corresponding call to the stopPlayingSoundFile method must be done at some point after each invocation of this method.
Invoking this method could modify AVAudioSession current configuration to route audio to the speakers.
The sound file must be a mono (1 channel), 16-bit, uncompressed (PCM) .wav file with a sample rate of 8kHz, 16kHz, or 32kHz.
Throws
if no file exists at the given path
Declaration
Swift
public func startPlayingSoundFile(withPath path: String?, looping: Bool) throwsParameters
pathFull path for the sound file to play
loopingSpecifies whether the sound should loop or not
-
Stop playing the sound file.
Declaration
Swift
public func stopPlayingSoundFile() -
Configure the audio session for an incoming CallKit call.
Important
This method should be invoked before the CXAnswerCallAction is fulfilled.Declaration
Swift
public func configureAudioSessionForCallKitCall() -
Returns the set of currently available audio devices.
Declaration
Swift
public func availableAudioDevices() -> [SinchAudioDevice] -
Try to set the preferred audio device (input and output route together). If not available, no change is made. Pass
nilto clear the preference and use automatic routing (Bluetooth if available, else built-in).Declaration
Swift
public func setPreferredAudioDevice(_ device: SinchAudioDevice?)