Commit 4b0c9876 by olly Committed by Oliver Woodman

Fix StyledPlayerView detachment

Issue: #8985
#minor-release
PiperOrigin-RevId: 375913914
parent 614f9d8d
...@@ -64,6 +64,10 @@ ...@@ -64,6 +64,10 @@
* Keep subtitle language features embedded (e.g. rubies & tate-chu-yoko) * Keep subtitle language features embedded (e.g. rubies & tate-chu-yoko)
in `Cue.text` even when `SubtitleView#setApplyEmbeddedStyles()` is in `Cue.text` even when `SubtitleView#setApplyEmbeddedStyles()` is
false. false.
* UI
* Fix `NullPointerException` in `StyledPlayerView` that could occur after
calling `StyledPlayerView.setPlayer(null)`
([#8985](https://github.com/google/ExoPlayer/issues/8985)).
### 2.14.0 (2021-05-13) ### 2.14.0 (2021-05-13)
......
...@@ -579,6 +579,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider { ...@@ -579,6 +579,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
} }
@Nullable Player oldPlayer = this.player; @Nullable Player oldPlayer = this.player;
if (oldPlayer != null) { if (oldPlayer != null) {
oldPlayer.removeListener(componentListener);
if (surfaceView instanceof TextureView) { if (surfaceView instanceof TextureView) {
oldPlayer.clearVideoTextureView((TextureView) surfaceView); oldPlayer.clearVideoTextureView((TextureView) surfaceView);
} else if (surfaceView instanceof SurfaceView) { } else if (surfaceView instanceof SurfaceView) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment