为什么iPod的音频不退色后我的应用程序导致它淡出? [英] Why does iPod's audio not fade back in after my app caused it to fade out?
问题描述
我的应用需要播放一些音频文件,我想淡出iPod声音,播放我的文件,然后一旦我的音频停止播放淡入iPod再次(就像iPhone处理iPod音乐时,调用进来)
My app needs to play some audio files and I want to fade-out the iPod sound, play my file, and then as soon as my audio stops playing fade-in iPod again (just like iPhone handles iPod music when an incoming call comes in)
我将我的应用程序的音频会话设置为kAudioSessionCategory_MediaPlayback,然后在我播放我的文件之前调用AudioSessionSetActive(true)
当我的文件结束播放我调用AudioSessionSetActive(false)
I'm setting up my app's Audio Session to be kAudioSessionCategory_MediaPlayback and then just before I play my file I call AudioSessionSetActive (true) then when my file ends playing I call AudioSessionSetActive (false)
会发生什么是iPod音频淡出与AudioSessionSetActive(true)调用,但它永远不会淡入再次调用AudioSessionSetActive(false)
What happens is that the iPod audio fades-out with the AudioSessionSetActive (true) call, but it never fades-in again after I call AudioSessionSetActive (false)
我使用AVFoundation类播放我的音频,我的audioPlayerDidFinishPlaying在我的委托方法,这是我调用AudioSessionSetActive(false)。
I'm using AVFoundation class to play my audio, I audioPlayerDidFinishPlaying in my delegate method and that's where I call AudioSessionSetActive (false).
我在这里缺少什么?为什么当我停用我的音频会话时,iPod是否会淡入?我有错误的音频会话类别吗?
What am I missing here? Why doesn't the iPod fade-in when I deactive my audio session? Do I have the wrong Audio Session Category for this?
推荐答案
我得到苹果的答复。不幸的是,它是不可能的SDK 2.2。我提交了一个功能请求,所以谁知道也许在将来添加这个功能。
I got an answer from Apple about this. Unfortunately, it is not possible with SDK 2.2. I submitted a feature request, so who knows maybe the add this functionality in the future.
这篇关于为什么iPod的音频不退色后我的应用程序导致它淡出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!