I am coding a iOS apps with core audio. Something strange come across.
To do:
AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *err = nil;
[session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDuckOthers error:&err];
[session setActive:YES error:&err];
I find everything is ok, background music is ducked. Then I try to resume it:
[session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&err];
With no error, but the back ground music is still ducked. Then I replace it with:
[session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:0 error:&err];
It works! Background music is gone!
I just don't understand why my first try fails and the second one successes?
In my view, there is no difference!