Skip to content

Commit

Permalink
Fix surface reuse issues and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
armands-malejevs committed May 30, 2023
1 parent 768eef6 commit e8a7c50
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java
Expand Up @@ -131,6 +131,7 @@ public void setAdOverlay(FrameLayout adOverlay) {
}

private void clearVideoView() {
Log.w("RNV", "clearVideoView()");
if (surfaceView instanceof TextureView) {
player.clearVideoTextureView((TextureView) surfaceView);
} else if (surfaceView instanceof SurfaceView) {
Expand All @@ -139,6 +140,7 @@ private void clearVideoView() {
}

private void setVideoView() {
Log.w("RNV", "setVideoView()");
if (surfaceView instanceof TextureView) {
player.setVideoTextureView((TextureView) surfaceView);
} else if (surfaceView instanceof SurfaceView) {
Expand All @@ -148,19 +150,27 @@ private void setVideoView() {

private void updateSurfaceView() {
View view;
Log.w("RNV", "DEBUG1");
if (!useTextureView || useSecureView) {
if (surfaceView instanceof TextureView) {
Log.w("RNV", "DEBUG2");
if (surfaceView != null && surfaceView instanceof SurfaceView) {
Log.w("RNV", "DEBUG3");
view = surfaceView;
} else {
Log.w("RNV", "DEBUG4");
view = new SurfaceView(context);
}
if (useSecureView) {
Log.w("RNV", "DEBUG5");
((SurfaceView)view).setSecure(true);
}
} else {
if (surfaceView instanceof TextureView) {
Log.w("RNV", "DEBUG6");
if (surfaceView != null && surfaceView instanceof TextureView) {
Log.w("RNV", "DEBUG7");
view = surfaceView;
} else {
Log.w("RNV", "DEBUG8");
view = new TextureView(context);
}
}
Expand All @@ -173,6 +183,7 @@ private void updateSurfaceView() {
layout.addView(surfaceView, 0, layoutParams);

if (this.player != null) {
Log.w("RNV", "DEBUG9");
setVideoView();
}
}
Expand Down

0 comments on commit e8a7c50

Please sign in to comment.