不获取AudioListenerInterruptionEnd触发器
我对 OpenAl 和 MPMoviePlayerController 的组合有疑问。
我在 OpenAl 设置过程中注册了 AudioInterruptionLister。当我开始播放视频时,侦听器会收到 AudioListenerInterruptionStarts,但当电影结束时,我不会收到 AudioListenerInterruptionEnd 触发器。
// Register callback for audio interrupts
AudioSessionInitialize(NULL, NULL, &OpenALInterruptionListener, this);
监听器
void OpenALInterruptionListener(void *inClientData, UInt32 inInterruptionState)
{
OpenAL *oal = (OpenAL *) inClientData;
if (inInterruptionState == kAudioSessionBeginInterruption)
{
oal->MakeContextNull();
AudioSessionSetActive(false);
}
else if (inInterruptionState == kAudioSessionEndInterruption)
{
AudioSessionSetActive(true);
oal->MakeContextCurrent();
}
}
到目前为止,我的解决方案是在开始电影之前使上下文无效,并在电影结束后将其设置为当前上下文。这导致了一个问题,如果用户通过触摸屏幕快速跳过电影,我会将上下文设置为当前上下文,并且稍微延迟一点,我会得到 AudioListenerInterruptionStart 触发器,该触发器将我的上下文再次设置为空。
在 iO 3.1 更高版本上,我可以设置 useApplicationAudioSession = NO,并且侦听器永远不会成为开始或结束触发器。但在低于 3.2 的 iOS 上,htis 选项不存在。
但我的主要问题是,为什么我从来没有得到 AudioListenerInterruptionEnd 触发器。
感谢您的帮助 此致 格奥尔格
I have a problem with the combination of OpenAl and the MPMoviePlayerController.
I registered the AudioInterruptionLister in my OpenAl Setup process. When I start a video the listener receives the AudioListenerInterruptionStarts, but when the movie ends I do not receive the AudioListenerInterruptionEnd trigger.
// Register callback for audio interrupts
AudioSessionInitialize(NULL, NULL, &OpenALInterruptionListener, this);
The listener
void OpenALInterruptionListener(void *inClientData, UInt32 inInterruptionState)
{
OpenAL *oal = (OpenAL *) inClientData;
if (inInterruptionState == kAudioSessionBeginInterruption)
{
oal->MakeContextNull();
AudioSessionSetActive(false);
}
else if (inInterruptionState == kAudioSessionEndInterruption)
{
AudioSessionSetActive(true);
oal->MakeContextCurrent();
}
}
My solution until now was to make the context invalid before starting the movie and make it current after movie ends. That leads to the problem, that if the user skips the movie very fast by touching the screen, I make the context current and a little bit delayed I get AudioListenerInterruptionStart trigger that sets my context to null again.
On iOs greater 3.1 I can set useApplicationAudioSession = NO and the listener does never becomes a start or end trigger. But on iOS lower than 3.2 htis option does not exists.
But my main question is, why does I never get the AudioListenerInterruptionEnd trigger.
Thanks for help
best regards
Georg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论