[3.13.1] AudioEngine在锁屏或者切到后台背景音乐不会暂停

AudioEngine在锁屏或者切到后台背景音乐不会暂停
求解,怎么暂停?

@dumganhar 这个你看一下吧。

// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
void AppDelegate::applicationDidEnterBackground() {
    Director::getInstance()->stopAnimation();

    AudioEngine::pauseAll();
}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
    Director::getInstance()->startAnimation();

    AudioEngine::resumeAll();
}

在你工程的AppDelegate.cpp中,前后台切换的时候,调用pauseAll, resumeAll.

现在用的ccc版本是1.8.2; 我按你这样加了。 编译的时候报错。 ‘AudioEngine’ has not been declared; 请问怎么解决

忘了加头文件吧?