diff --git a/CHANGELOG.md b/CHANGELOG.md index ec0a1aa6..4768d96b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.14.1] (2023-11-16) + +### Fixed + +- Android: `PlayerView` destroys attached `Player` instance on destroy. `Player` lifecycle must be handled on the creation side + ## [0.14.0] (2023-11-14) ### Added diff --git a/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt b/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt index d3c18ca0..c2d166e7 100644 --- a/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt +++ b/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt @@ -149,6 +149,7 @@ class RNPlayerView( private var _playerView: PlayerView? = null set(value) { + field?.removeOnLayoutChangeListener(this) field = value viewEventRelay.eventEmitter = field playerEventRelay.eventEmitter = field?.player @@ -157,8 +158,7 @@ class RNPlayerView( /** * Associated Bitmovin's `PlayerView`. */ - val playerView: PlayerView? - get() = _playerView + val playerView: PlayerView? get() = _playerView private var subtitleView: SubtitleView? = null @@ -186,11 +186,15 @@ class RNPlayerView( * Cleans up the resources and listeners produced by this view. */ fun dispose() { - viewEventRelay.eventEmitter = null - playerEventRelay.eventEmitter = null - playerView?.removeOnLayoutChangeListener(this) - playerView?.onDestroy() activityLifecycle.removeObserver(activityLifecycleObserver) + + val playerView = _playerView ?: return + _playerView = null + // The `RNPlayerView` should not take care of the player lifecycle. + // As a different component is creating the player instance, the other component + // is responsible for destroying the player in the end. + playerView.player = null + playerView.onDestroy() } /** diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 12d7437b..7ccd26b4 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -345,7 +345,7 @@ PODS: - React-jsi (= 0.69.6-2) - React-logger (= 0.69.6-2) - React-perflogger (= 0.69.6-2) - - RNBitmovinPlayer (0.14.0): + - RNBitmovinPlayer (0.14.1): - BitmovinPlayer (= 3.48.0) - GoogleAds-IMA-iOS-SDK (= 3.18.4) - GoogleAds-IMA-tvOS-SDK (= 4.8.2) @@ -574,7 +574,7 @@ SPEC CHECKSUMS: React-RCTText: f72442f7436fd8624494963af4906000a5465ce6 React-runtimeexecutor: f1383f6460ea3d66ed122b4defb0b5ba664ee441 ReactCommon: 7857ab475239c5ba044b7ed946ba564f2e7f1626 - RNBitmovinPlayer: 7b30750994923ebfe825e82f9182cd0e03e1b708 + RNBitmovinPlayer: e2436bccf53ed596ece178e6553ea7268d792163 RNCPicker: 0250e95ad170569a96f5b0555cdd5e65b9084dca RNScreens: 4a1af06327774490d97342c00aee0c2bafb497b7 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 diff --git a/package.json b/package.json index dc49fb5d..c5d839ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitmovin-player-react-native", - "version": "0.14.0", + "version": "0.14.1", "description": "Official React Native bindings for Bitmovin's mobile Player SDKs.", "main": "lib/index.js", "module": "lib/index.mjs",