mattermost-mobile/patches/react-native-video+6.12.0.patch
2025-07-22 14:00:57 +08:00

22 lines
903 B
Diff

diff --git a/node_modules/react-native-video/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.kt b/node_modules/react-native-video/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.kt
index ee24982..8f952db 100644
--- a/node_modules/react-native-video/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.kt
+++ b/node_modules/react-native-video/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.kt
@@ -217,6 +217,17 @@ class ExoPlayerView(private val context: Context) :
}
}
+ override fun onDetachedFromWindow() {
+ super.onDetachedFromWindow()
+ player?.let {
+ it.playWhenReady = false
+ it.stop()
+ it.clearVideoSurface()
+ it.release()
+ }
+ player = null
+ }
+
override fun requestLayout() {
super.requestLayout()
post(measureAndLayout)