Do not get the AudioListenerInterruptionEnd trigger

混江龙づ霸主 提交于 2019-12-11 03:41:18

问题


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

来源:https://stackoverflow.com/questions/3785632/do-not-get-the-audiolistenerinterruptionend-trigger

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