(IOS) Music from an external player stops when running my app. How do I prevent this from happening?

As the title says, is there some way to avoid this? I want to keep any music from an external music player, playing when I run my app.

I am facing the same problem with version 3.9. Basically, when launching my game, I’d like the music from the music player on the ios device to continue and not play the music inside my game. Instead, what’s happening is that the music from my game is overriding the music from the music player.

Is there a way to control this behavior? I scanned the forum and I was surprised that there is no solution and that more people are not talking about it.

Actually I don’t know, how this is done with Cocos Creator, but maybe it is helpful to know how it’s done in cocos2d-x.


You have to set the AudioSessionCategory, if I remember correctly.
Add the following line to RootViewController.mm right under -(void)loadView {:

    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];

Of course you also need to add

#import <AVFoundation/AVFoundation.h>

to the top.

Hi All

Could you find a solution for this topic?

Best Regards

The same issue with cocos2d 3.16 on android.
How to fix it on android?