fix(android): fix leak caused by removing lifecycle listener too early (#3380)

* Fix lifecycle listener being removed too early
This commit is contained in:
Sung Jeon 2023-11-24 07:23:44 +09:00 committed by GitHub
parent b3744f9b9f
commit 0c0f3174cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,6 @@
# [6.0.0-beta.1](https://github.com/react-native-video/react-native-video/compare/v6.0.0-beta.0...v6.0.0-beta.1) (WIP)
* **android:** fix leak caused by removing lifecycle listener too early ([#3380](https://github.com/react-native-video/react-native-video/pull/3380))
# [6.0.0-beta.0](https://github.com/react-native-video/react-native-video/compare/v6.0.0-alpha.11...v6.0.0-beta.0) (2023-11-18)

View File

@ -349,6 +349,7 @@ public class ReactExoplayerView extends FrameLayout implements
@Override
public void onHostDestroy() {
stopPlayback();
themedReactContext.removeLifecycleEventListener(this);
}
public void cleanUpResources() {
@ -881,7 +882,6 @@ public class ReactExoplayerView extends FrameLayout implements
}
adsLoader = null;
progressHandler.removeMessages(SHOW_PROGRESS);
themedReactContext.removeLifecycleEventListener(this);
audioBecomingNoisyReceiver.removeListener();
bandwidthMeter.removeEventListener(this);