应用程序放入后台后 AVAssetReader 失败,为什么?

发布于 2024-12-07 11:31:53 字数 578 浏览 1 评论 0原文

我使用 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 是否有我不知道的限制?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

够钟 2024-12-14 11:31:53
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);
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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文