4

I have playback working with AVAssetReader and iPod library and when I put the the app in the background it will continue reading in audio to the playback buffer but when it gets to the end of a song and starts reading on the next song it fails when startReading is called. I get the following error details.

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation couldn’t be completed.  (AVFoundationErrorDomain error -11800.)" UserInfo=0x1bfc20 {NSUnderlyingError=0x113e00 "The operation couldn’t be completed. (OSStatus error -12985.)"}
{
    NSUnderlyingError = "Error Domain=NSOSStatusErrorDomain Code=-12985 \"The operation couldn\U2019t be completed. (OSStatus error -12985.)\"";
}

Is there a limitation on AVAssetReader that I do not know about?

Brennan
  • 11,546
  • 16
  • 64
  • 86
  • Hi Brennen, did you ever solve this issue? I've been banging my head against it but am still stuck.. – Dick Feb 09 '13 at 02:38

1 Answers1

-1
NSError *sessionError = nil;
    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&sessionError];
    UInt32 doSetProperty = 1;
    OSStatus tStatus = AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryMixWithOthers,
                                                sizeof (doSetProperty),
                                                &doSetProperty
                                                );
    NSLog(@"AVAudioSession AudioSessionSetProperty status is %@", tStatus);
    [[AVAudioSession sharedInstance] setActive:YES error:&sessionError];
    [[AVAudioSession sharedInstance] setDelegate:self];
    NSLog(@"AVAudioSession setActive Error is %@", sessionError);
Dex
  • 12,527
  • 15
  • 69
  • 90
hu.cao
  • 1
  • 1
    It's a little hard to read this answer. Can you format it as code? Also, can you explain exactly why this works? – Brennan Nov 03 '11 at 14:50