diff --git a/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java index a57b91f9..dd18dbfd 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java @@ -161,8 +161,22 @@ public final class ExoPlayerView extends FrameLayout implements AdViewProvider { } } + private void hideShutterView() { + shutterView.setVisibility(INVISIBLE); + surfaceView.setAlpha(1); + } + + private void showShutterView() { + shutterView.setVisibility(VISIBLE); + surfaceView.setAlpha(0); + } + private void updateShutterViewVisibility() { - shutterView.setVisibility(this.hideShutterView ? View.INVISIBLE : View.VISIBLE); + if (this.hideShutterView) { + hideShutterView(); + } else { + showShutterView(); + } } @Override @@ -194,7 +208,9 @@ public final class ExoPlayerView extends FrameLayout implements AdViewProvider { clearVideoView(); } this.player = player; - shutterView.setVisibility(this.hideShutterView ? View.INVISIBLE : View.VISIBLE); + + updateShutterViewVisibility(); + if (player != null) { setVideoView(); player.addListener(componentListener); @@ -281,7 +297,7 @@ public final class ExoPlayerView extends FrameLayout implements AdViewProvider { @Override public void onRenderedFirstFrame() { - shutterView.setVisibility(INVISIBLE); + hideShutterView(); } @Override diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.kt b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.kt index 8299c345..195875be 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.kt +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.kt @@ -276,9 +276,9 @@ class ReactExoplayerViewManager(private val config: ReactExoplayerConfig) : View videoView.setSubtitleStyle(SubtitleStyle.parse(src)) } - @ReactProp(name = PROP_SHUTTER_COLOR, defaultInt = 0) + @ReactProp(name = PROP_SHUTTER_COLOR, defaultInt = Color.BLACK) fun setShutterColor(videoView: ReactExoplayerView, color: Int) { - videoView.setShutterColor(if (color == 0) Color.BLACK else color) + videoView.setShutterColor(color) } @ReactProp(name = PROP_BUFFER_CONFIG)