-
Notifications
You must be signed in to change notification settings - Fork 148
Description
Hello. First of all I want to thank you for developing such an amazing library.
I was going through the source code (inside the Source folder) to learn how the library is implemented. I understand all the source code and what's going one, except for two questions I've got:
-
Check here. Why is the AudioSession category
playAndRecord? I mean, this library doesn't do playback at all. However, if I change the category torecordonly, an error is thrown at runtime. -
Check here. What is going on? The comment says
//Check input type.... but it's clearly referencingcurrentRoute.outputs.... so is it input or output?
I checked Apple documentation. It says this aboutoverrideOutputAudioPort:
If your app uses the playAndRecord category, calling this method with the AVAudioSession.PortOverride.speaker option causes the system to route audio to the built-in speaker and microphone regardless of other settings. This change remains in effect only until the current route changes or you call this method again with the AVAudioSession.PortOverride.none option.
I understand the intent of the code. If we don't have any headphones (with microphone) plugged in, force the system to use the built-in mic. However, I think this falls back to these questions: 1. isn't this the default behaviour? and 2. why use category playAndRecord ?
Thanks!