AudioQueueStart fail -12985

喜你入骨 提交于 2019-11-29 06:42:54

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.

I also faced with such problem week ago. I've spent two days to find solution and I found it. May be this link will help (it is official answer): http://developer.apple.com/library/ios/#qa/qa1668/_index.html

Make sure that you activate session from applicationDidEnterBackground task handler. Now my application can play sound in background.

ari gold

See this.

You probably need to include the following:

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];

Towards the bottom there is a reiteration of the how important that line is. As it is not mentioned in any of the three main audio audio guides (AVFoundation, AudioSession, or AudioQueue) it can easily be missed.

I have the same problem. I registry the AudioSessionInterruptionListener, pause the audio when phone call, resume it after the call end. but get -12985 error code when call AudioQueueStart to resume. My solution is that I try to call AudioQueueStart after 0.02s. I don't know the reason.

On iOS7, AudioQueueStart was returning '!int' ('tni!'), though i'm sure no one would be surprised to find that it's not documented in the docs or headers. It was the same issue, though, and the same fix (setting the audio session to active in the background task handler) worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!