Open jagan27101986 opened 5 years ago
same problem
Hi, look at: https://stackoverflow.com/questions/38690103/cordova-sounds-stop-background-music Is it fix for that?
I resolved the issue by adding the following code [session setCategory:AVAudioSessionCategoryAmbient error:NULL]; in - (void) configureAudioSession method. Everthing works as expected.
@katzer - Could you please update in the file; so everytime i dont have have to copy and paste it.
I resolved the issue by adding the following code [session setCategory:AVAudioSessionCategoryAmbient error:NULL]; in - (void) configureAudioSession method. Everthing works as expected.
@katzer - Could you please update in the file; so everytime i dont have have to copy and paste it.
I have a same problem. I tried your solution but it does not work for me. Which file did you modify?
FileName - APPBackgroundMode.m Copy and paste this method /**
Configure the audio session. */
// Don't activate the audio session yet [session setActive:NO error:NULL];
// Play music even in background and dont stop playing music // even another app starts playing sound [session setCategory:AVAudioSessionCategoryPlayback error:NULL];
[session setCategory:AVAudioSessionCategoryAmbient error:NULL];
// Active the audio session [session setActive:YES error:NULL]; };
FileName - APPBackgroundMode.m Copie e cole este método / **
Configure a sessão de áudio.
- /
(vazio) configureAudioSession { AVAudioSession * session = [AVAudioSession sharedInstance]; // Não ative a sessão de áudio ainda [session setActive: NO error: NULL]; // Toca música mesmo em segundo plano e não para de tocar // outro aplicativo começa a reproduzir som [session setCategory: AVAudioSessionCategoryPlayback error: NULL]; [sessão setCategory: erro AVAudioSessionCategoryAmbient : NULL]; // Ativa a sessão de áudio [session setActive: YES error: NULL]; };
@jagan27101986 do you use cordova-music-controls? How do you control the media you're playing? ios overwrites the media controls automatically, i have been struggling for weeks...
The solution is only about when opening the application, the music player or any third party application stops playing the file. However, this has nothing to do with music controls.
@katzer - Could you please add the line [session setCategory:AVAudioSessionCategoryAmbient error:NULL]; and update the git hub repo ?
i think this Plugin is not maintained anymore, so i decided to create a new one and fix this Issue. It also has a Ionic Wrapper, so go ahead and use this: https://github.com/HansKrywaa/cordova-plugin-advanced-background-mode
@HansKrywaa Thanks a lot your plugin saved me a lot of time. appreciate it man
When the application starts in IOS after Splash Screen, the music player of IOS is stopped working. We are using Ionic 4 application. Please advise how to resolve the issue.