iOS AVAudioSession Category and Mode

380 views
Skip to first unread message

vishalr...@gmail.com

unread,
Oct 15, 2022, 3:25:37 AM10/15/22
to discuss-webrtc
Is it possible to modify AVAudioSession Category and Mode?

I have noticed that webrtc is using playAndRecord as category and voiceChat as mode by default.

However, even after i set it manually as below it still takes PlayAndRecord

rtcAudioSession.setCategory(AVAudioSession.Category.playback.rawValue, with:[.mixWithOthers])
rtcAudioSession.setMode(AVAudioSession.Mode.spokenAudio.rawValue)

I want to make sure that peer connection does not request access to microphone as it is being used by different process in my application.

Is there any other way to specify category and mode ?

Henrik Andreasson

unread,
Oct 15, 2022, 6:47:34 AM10/15/22
to discuss...@googlegroups.com
See webrtc/5873 for a discussion about the issue you are trying to solve. There is no simple fix to this problem and changing the category and mode is not sufficient since the current design is "hard-coded" for full-duplex. 

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/b77d69cf-5e48-41f2-8805-089e1b34b6cfn%40googlegroups.com.

vishalr...@gmail.com

unread,
Oct 17, 2022, 6:01:01 AM10/17/22
to discuss-webrtc
Thank you for response.

This gave me better understanding of problem.

I believe injecting a custom ADM is the best option to achieve what i require.

Since there is very limited documentation available for custom ADM, I have some questions on how to do that.

I can copy audio_device_module_ios and remove method bodies related to recording device, can it work? Is there a sample ADM available which can work as play only i.e. no recording ?

Henrik Andreasson

unread,
Oct 17, 2022, 6:23:53 AM10/17/22
to discuss...@googlegroups.com
More work has been done in https://bugs.chromium.org/p/webrtc/issues/detail?id=14193 and it links to external implementations in https://github.com/mstyura/RTCAudioDevice.
I don't think that any of those implementations solves your exact problem. 

Reply all
Reply to author
Forward
0 new messages