AudioQueueStart失败-12985 [英] AudioQueueStart fail -12985

查看:205
本文介绍了AudioQueueStart失败-12985的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个流式音乐播放器,它在前台工作正常。
但是在后台iOS4中,它不会自动播放下一首歌曲。 (遥控器有效)
原因是 AudioQueueStart返回-12985

I made a streaming music player and it works fine in the foreground. But in the background iOS4, it doesn't play the next song automatically. ( remote control works ) The reason is AudioQueueStart return -12985.

我已经检查了音频会话。它很好。我开始播放音乐时使用 AudioQueueStart
如何删除 AudioQueueStart

I already check the audio session. it just fine. I use AudioQueueStart when it start to play the music. How can you remove AudioQueueStart?

- (void)play
{
    [self setupAudioQueueBuffers];    // calcluate the size to use for each audio queue buffer, and calculate the // number of packets to read into each buffer
    OSStatus status = AudioQueueStart(self.queueObject, NULL); 
}






我读了答案关于 AudioQueueStart 失败主题的网页。


要检查的一件事是AudioSession首先处于活动状态。
在我的情况下,我之前在开始播放新歌之前将歌曲更改设置为无效: AudioSessionSetActive(false);

一旦我删除了这个AudioQueueStart就可以在后台运行。

Once I removed this AudioQueueStart works just fine from the background.

推荐答案

根据我的经验,发生-12985消息是因为当您尝试在应用中开始播放时,另一个应用已经激活了音频会话。选项是1)指示用户关闭其他应用程序,或2)设置混合模式(参见kAudioSessionProperty_OverrideCategoryMixWithOthers)。

In my experience, the -12985 message occurs because another app already has an audio session active when you try to start playback in your app. Options are to 1) instruct the user to close the other app, or 2) set mix mode (see kAudioSessionProperty_OverrideCategoryMixWithOthers).

混合模式的缺点是如果你依赖锁屏艺术或遥控器,它们不适用于混合模式设置。

The disadvantage of mix mode is if you depend on lock screen art or remote controls, they won't work with mix mode set.

这篇关于AudioQueueStart失败-12985的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆