katzer / cordova-plugin-background-mode

Keep app running in background
Apache License 2.0
1.38k stars 1.02k forks source link

When Application Launch, Music Player Stops in Ios #481

Open jagan27101986 opened 5 years ago

jagan27101986 commented 5 years ago

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.

andreveigaelias commented 5 years ago

same problem

kissk01 commented 5 years ago

Hi, look at: https://stackoverflow.com/questions/38690103/cordova-sounds-stop-background-music Is it fix for that?

jagan27101986 commented 4 years ago

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.

mehdis34 commented 4 years ago

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?

jagan27101986 commented 4 years ago

FileName - APPBackgroundMode.m Copy and paste this method /**

paulovargatt commented 4 years ago

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...

jagan27101986 commented 4 years ago

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.

jagan27101986 commented 4 years ago

@katzer - Could you please add the line [session setCategory:AVAudioSessionCategoryAmbient error:NULL]; and update the git hub repo ?

EinfachHans commented 4 years ago

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

bassm commented 4 years ago

@HansKrywaa Thanks a lot your plugin saved me a lot of time. appreciate it man