I have an audio app, and when AVAudioSessionRouteChangeNotification
comes on, the app configures AV and tests for headphone use and such.
However, Siri activates the AVAudioSessionRouteChangeNotification
, but because of the AV configuration, Siri isn't able to be used by the user (the microphone doesn't work for her, it seems.)
Is there a way to find out if Siri is the thing causing the AVAudioSessionRouteChangeNotification
, so that I don't call the method to configure AV if it's Siri and thus let the user use Siri?
You're right, both headphone plugging in/out and Siri activating will trigger
AVAudioSessionRouteChangeNotification
, however, notice theAVAudioSessionRouteChangeReasonKey
associated with the notificationWhen headphone is plugged in, the reason is
AVAudioSessionRouteChangeReasonNewDeviceAvailable
When headphone is plugged out, the reason is
AVAudioSessionRouteChangeReasonOldDeviceUnavailable
When Siri is activated, the reason is
AVAudioSessionRouteChangeReasonCategoryChange
And use below code in AVAudioSessionRouteChangeNotification event if you want to check Siri start or finish: