Hi all,
I got some crashes in an app for quite some time, and I finally understood why. My app uses AVAudioSession for audio input and output with real-time interaction, and also uses the Google pod youtube-ios-player-helper to display YouTube videos. The problem is that the youtube player, on which I have very little control, modifies my AudioSession, and especially changes the current sample rate, resulting in some serious buffer issues in my audio code.
My question is the following :
Is there any way to get notified when the sampleRate of the audio session is changed?
I did some research, tried a few a few things, none worked. More precisely :
- The sampleRate property of AVAudioSession is not key value observable.
- A change of sample rate does not trigger any call to the handle route notification or the media services reset notification.
Any idea how to get notified when the sample rate of the audio session is changed?
The sample rate of the audio session is a key information for an audio app. If it can be changed by other components, there should be a way to get notified in order to be able to take it into account!
Thanks,
Best,
Thomas