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 buff开发者_如何转开发er 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?
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);
精彩评论