Both Real-Time Communication (RTC) SDK for iOS and audio applications have the control permissions on AVAudioSession. You can manage the control permissions on AVAudioSession based on your requirements. This topic describes how to manage the control permissions on AVAudioSession.
Background information
Both RTC SDK and audio applications have the control permissions on AVAudioSession. To ensure that the voice call feature provided by RTC SDK can be used, the control permissions granted to RTC SDK take priority over those granted to audio applications. However, if you need to stop using RTC SDK and use audio applications instead such as music players and third-party audio components, you must restrict the control permissions granted to RTC SDK.
Solution
RTC SDK allows you to call the following method to restrict the control permissions on AVAudioSession granted to RTC SDK. After you call this method to give priority to the control permissions granted to an audio application, make sure that the application manages the control permissions so that the features of RTC SDK can work properly. You can also call the same method to give priority back to the control permissions granted to RTC SDK.
- (int)setAudioSessionOperationRestriction:(AliRtcAudioSessionOperationRestriction)restriction;| Parameter | Type | Description |
| restriction | AliRtcAudioSessionOperationRestriction | The control permission on AVAudioSession. Default value: AliAudioSessionOperationRestrictionNone. |