voximplant / flutter_callkit

Flutter SDK for CallKit integration to Flutter applications on iOS
MIT License
53 stars 18 forks source link

what controls audio output on accepting an incoming call #16

Closed cdg720 closed 3 years ago

cdg720 commented 3 years ago

accepting the incoming call (audio call) in the example opens the callkit with speaker on. what parameter controls that?

it looks like this: IMG_B7145F127F4F-1

YuliaGrigorieva commented 3 years ago

Hello @cdg720 ,

Audio device is not configurable from CallKit framework, but is configurable via AVAudioSession.

The reason why the speaker is enabled in the example is that I guess it is an incoming call and for incoming call default ringtone is played. Since it is a ringtone, it should be played loudly, so the user does not miss a call. CallKit (or iOS) configures AVAudioSession and set the appropriate audio route and category for the ringtone.

Since the example provides a sample code for the plugin usage, we do not configure AVAudioSession.

If you integrate a plugin to an app with real VoIP calls, it should not happen unless you select the speaker for a call. Any library that provides VoIP calls functionality, changes AVAudioSession configuration and routes once a call is answered.

Best regards, Yulia Grigorieva

cdg720 commented 3 years ago

thank you!