fix(android): hide surfaceView for loading time when shutter is hidden (#4060)
* fix(android): hide surfaceView for loading time when shutter is hidden * fix: hide/show surface view without casting
This commit is contained in:
parent
b05201a9fa
commit
65faba312d
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user