ddurham2 commented on issue #299:
URL:
https://github.com/apache/cordova-plugin-media/issues/299#issuecomment-2777943823
Here's the fix:
```
diff -ru node_modules/cordova-plugin-media/src/android/AudioHandler.java
node_modules/cordova-plugin-media/src/android/AudioHandler.java
--- a/node_modules/cordova-plugin-media/src/android/AudioHandler.java
+++ b/node_modules/cordova-plugin-media/src/android/AudioHandler.java
@@ -267,6 +267,12 @@
if (players.isEmpty()) {
onLastPlayerReleased();
}
+
+ // This is required in case we release the audio while the system
has paused us for e.g. a phone call
+ // If we don't, it'll get resumed when the phone call ends, even if
we've destroyed the AudioPlayer
+ AudioManager am = (AudioManager)
this.cordova.getActivity().getSystemService(Context.AUDIO_SERVICE);
+ am.abandonAudioFocus(focusChangeListener);
+
audio.destroy();
return true;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]