AudioEngine在锁屏或者切到后台背景音乐不会暂停
求解,怎么暂停?
// 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; 请问怎么解决
忘了加头文件吧?