react-native-media-notification 0.4.0-beta.2 → 0.4.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -141,12 +141,20 @@ class MediaControlsService : MediaLibraryService() {
141
141
  super.onDestroy()
142
142
  }
143
143
 
144
+ override fun onTaskRemoved(rootIntent: Intent?) {
145
+ // fixes crash according to: https://github.com/androidx/media/issues/422#issuecomment-2308495584
146
+ mediaSession = null
147
+ super.onTaskRemoved(rootIntent)
148
+ }
149
+
144
150
  fun stopNotificationAndService() {
145
151
  stopForeground(Service.STOP_FOREGROUND_REMOVE)
146
152
  stopSelf()
147
153
  player?.releaseFocus()
148
- mediaSession?.release()
149
- mediaSession = null
154
+ mediaSession?.runCatching {
155
+ release()
156
+ mediaSession = null
157
+ }
150
158
  }
151
159
 
152
160
  fun getPlayer(): MediaControlsPlayer? = player
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-media-notification",
3
- "version": "0.4.0-beta.2",
3
+ "version": "0.4.0-beta.3",
4
4
  "description": "Display and manage media style notifications based on react-native-music-control",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",