AVAssetReader error after the application is placed in the background, why?

I have a playback that works with the AVAssetReader library and iPod, and when I put the application in the background, it will continue to read audio into the playback buffer, but when it reaches the end of the song and starts reading the next song, startReading fails to start. I get the following error information.

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 restriction on AVAssetReader that I don't know about?

+4
source share
1 answer
 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); 
-1
source

All Articles