Search code examples
iphoneios4core-audioopenal

AVassetExportSession kills my audio


when I start –exportAsynchronouslyWithCompletionHandler: method of AVassetExportSession my audio is stops playing. I am using AudioQueue and OpenAL they both needs to be restarted after beginning export session. Is there any trick to make them work without restarting audios?


Solution

  • Well. Nobody has answered to me, so I will answer myself. Figured that when exporting with AVAssetExportSession it creates its own audio queue therefore it kills my, so before starting my queue all I need is to set some properties to AudioSession.

    AudioSessionInitialize(CFRunLoopGetCurrent(), 
                                 kCFRunLoopCommonModes, 
                                 NULL, 
                                 NULL);
    AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, 
                                  sizeof(kAudioSessionCategory_MediaPlayback), 
                                  &(int) 
                                  {kAudioSessionCategory_MediaPlayback});
    AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, 
                                  sizeof (UInt32), 
                                  &(UInt32) 
                                  {1});
    AudioSessionSetActive(YES);