cordova-plugin-nativeaudio
cordova-plugin-nativeaudio copied to clipboard
Background music stop when the application start
On Android, when I call the function preloadSimple and preloadComplex, the background music(like Google Music) stops.
Same problem on iOS, stops music play (Apple Music) when calls preloadSimple and preloadComplex
+1 same problem issue also described here https://stackoverflow.com/questions/38690103/cordova-sounds-strop-background-music
I found how to fix it for iOS, it is explained here http://stackoverflow.com/questions/10180500/how-to-use-kaudiosessionproperty-overridecategorymixwithothers I changed the file 'NativeAudio.m' like that
- (void)pluginInitialize
{
self.fadeMusic = NO;
AVAudioSession *session = [AVAudioSession sharedInstance];
// we activate the audio session after the options to mix with others is set
[session setActive: NO error: nil];
NSError *setCategoryError = nil;
// Allows the application to mix its audio with audio from other apps.
if (![session setCategory:AVAudioSessionCategoryPlayback
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:&setCategoryError]) {
NSLog (@"Error setting audio session category.");
return;
}
[session setActive: YES error: nil];
}
However, I didn't find how to fix the problem for android.
Same problem here. (iOS + Android) @ThibaudD , do you mind making a pull request?
If I use the latest version the background music still stops.
If I make a fork and replace the code from @ThibaudD above the background music doesn't stop but the fading does not work
It still happens on Android with version 3.0.9
I made a pull request #139 for fixing this.
I changed plugin version and the issue still happens :(
When I try to listen to music using Spotity, the music stop when I opened the app, but if I try to listen to the song inside the device and open the app, the music doesn't stop.
It still hapens