Jump to content

In Phonegap Phaser stops background sound in iOS


bymafmaf
 Share

Recommended Posts

I'm almost finishing my first game with Phaser and using Phonegap with no huge issue so far. But in iOS when I open the app it stops the sound that is playing in the background such as Spotify.

 

Example phonegap app doesn't stop, I've tried. So problem must be with Phaser I thought, but in Android there is no problem. So I think it's about iOS WebKit and Phaser but couldn't figure out. Searching for days almost, with no luck..

Link to comment
Share on other sites

Guys normally Phonegap apps don't mute other background sounds.

 

I built an Invaders example game with Phonegap and it does the same. So, it's about Phaser's own SoundManager or something related to sound.

 

How come no one has no idea about that? No one uses Phonegap? Please guys...

Link to comment
Share on other sites

Finally found the solution!

 

It is actually the same way you do with objective-c.

 

In Xcode, open AppDelegate.m

 

1. add this where other #import codes are:

#import <AVFoundation/AVFoundation.h>

2. Find this in the file

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions{

add this to right under it:

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

Done!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...