gpt4 book ai didi

ios - 应用程序进入后台后,AVAssetReader 失败,为什么?

转载 作者:可可西里 更新时间:2023-11-01 06:17:27 25 4
gpt4 key购买 nike

我使用 AVAssetReader 和 iPod 库进行播放,当我将应用程序置于后台时,它将继续读取音频到播放缓冲区,但是当它到达一首歌曲的结尾并开始读取下一首歌曲时调用 startReading 时失败。我收到以下错误详细信息。

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.)\"";
}

AVAssetReader 是否有我不知道的限制?

最佳答案

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);

关于ios - 应用程序进入后台后,AVAssetReader 失败,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7615422/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com