Colin
Colin

Reputation: 3752

AVAudioSession setActive:NO not resuming ipod playback

In my iOS app, I first start a song in the iPod, then start my app. I push a button in my app, and call

AVAudioSession * audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryRecord error:&err];
[audioSession setActive:YES error:&err];

both of which succeed. I then start recording using audio queues, and that works too. But then when I'm done recording, I call

AVAudioSession * audioSession = [AVAudioSession sharedInstance];
[audioSession setActive:NO error:&err];

... which also succeeds.

The rub: I would expect the iPod's music to resume playing, but it doesn't. Am I forgetting something? There are no delegate events, so no interruptions.

Upvotes: 1

Views: 1851

Answers (1)

matt
matt

Reputation: 535557

You didn't say AVAudioSessionSetActiveFlags_NotifyOthersOnDeactivation, so the iPod music app wasn't notified that you deactivated.

However, there may be even more to it than that. In general, what some other app does isn't up to you. If you want to make iPod music play, use MPMusicPlayerController.

Upvotes: 1

Related Questions