redkoda
December 19, 2017, 8:30am
1
The problem happened on cocos2d-x 3.16 on iOS platform.
The following are the steps to reproduce.
Call [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&error]; at start up.
Open iTune, play a song.
Enter game, you should still hear the song.
Call CocosDenshion::SimpleAudioEngine::getInstance()->playEffect
-> it works.
Open an ADMOB ad with video.
iTune music resume
Call CocosDenshion::SimpleAudioEngine::getInstance()->playEffect
-> it doesn’t work.
I trace the code and found that _sourceGroups[sourceGroupId].enabled is false. Do you think you could help? Thank you very much.
redkoda
December 20, 2017, 6:19am
2
Just some updates. If I call the following in GADMobileAds, the playerEffect function works but the itune music stopped. It looks there are something conflict between GADMobileAds and Cocos2dx. The result is as below.
[[GADMobileAds sharedInstance] audioVideoManager].audioSessionIsApplicationManaged = YES;
Call [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&error]; at start up.
Call [[GADMobileAds sharedInstance] audioVideoManager].audioSessionIsApplicationManaged = YES;
Open iTune, play a song.
Enter game, you should still hear the song.
Call CocosDenshion::SimpleAudioEngine::getInstance()->playEffect
-> it works.
Open an ADMOB ad with video.
iTune music stopped and cannot resume.
Call CocosDenshion::SimpleAudioEngine::getInstance()->playEffect
-> it works.