1

As I previously found here.

If you start running an AVAssetReader while using a Remote I/O callback to play audio, starting the AVAssetReader will block the Remote I/O callback unless you allow iPod mixing with...

UInt32 audioCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,sizeof(audioCategory),&audioCategory);

AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof (UInt32), &(UInt32) {1});

However I am finding that this prevents the use of Audio Remote Control calls as setup here.

So...

  • I need "MixWithOthers" ON to use an AVAssetReader
  • I need "MixWithOthers" OFF to use Audio Remote Controls

Does anyone know of how I can setup my AudioSession so I can use both?

Community
  • 1
  • 1
TurqMage
  • 3,333
  • 2
  • 27
  • 52
  • I have the same problem. I am processing audio with an Audio Unit callback as I read from the iPod library using AVAssetReader. If I do not set MixWithOthers to TRUE each read from AVAssetReader interrupts playback. I am considering a different approach to see if it works. Specifically if I use Audio Queue Services and not Audio Units I wonder if it will work. Have you had any success? – Brennan Oct 10 '11 at 02:56
  • When I have MixWithOther TRUE my AVAssetReaders mix with playback but RemoteAudio controls don't work. When I have MixWithOther FALSE I have the AVAssetReader interrupting the playback. I had the same result with Audio Queues, but do tell me if it works for you. – TurqMage Oct 10 '11 at 15:45
  • It appears another app which also processes audio from the iPod library also have the same problem with remote events being blocked when MixWithOthers is used. I think there needs to be a new audio setting that enables AVAssetReader in the same as a running Audio Unit. It appears many apps want to make use of this combination of features. – Brennan Oct 11 '11 at 02:12

1 Answers1

0

This works now in iOS 5. The correct handling is to leave MixWithOthers OFF. The AVAssetReader will no longer stop the callbacks of your audio playback.

TurqMage
  • 3,333
  • 2
  • 27
  • 52