Merge pull request #1355 from vadimgoroshevsky/master
ExoPlayer - Add possibility to hide shutterView (black screen while loading)
This commit is contained in:
commit
39b475774c
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
### Version 4.0.1
|
### Version 4.0.1
|
||||||
* Add missing files to package.json [#1342](https://github.com/react-native-community/react-native-video/pull/1342)
|
* Add missing files to package.json [#1342](https://github.com/react-native-community/react-native-video/pull/1342)
|
||||||
|
* Add possibility to remove black screen while video is loading in Exoplayer [#1355](https://github.com/react-native-community/react-native-video/pull/1355)
|
||||||
|
|
||||||
### Version 4.0.0
|
### Version 4.0.0
|
||||||
* Partial support for timed metadata on Android MediaPlayer [#707](https://github.com/react-native-community/react-native-video/pull/707)
|
* Partial support for timed metadata on Android MediaPlayer [#707](https://github.com/react-native-community/react-native-video/pull/707)
|
||||||
|
@ -264,6 +264,7 @@ var styles = StyleSheet.create({
|
|||||||
* [fullscreenAutorotate](#fullscreenautorotate)
|
* [fullscreenAutorotate](#fullscreenautorotate)
|
||||||
* [fullscreenOrientation](#fullscreenorientation)
|
* [fullscreenOrientation](#fullscreenorientation)
|
||||||
* [headers](#headers)
|
* [headers](#headers)
|
||||||
|
* [hideShutterView](#hideshutterview)
|
||||||
* [id](#id)
|
* [id](#id)
|
||||||
* [ignoreSilentSwitch](#ignoresilentswitch)
|
* [ignoreSilentSwitch](#ignoresilentswitch)
|
||||||
* [muted](#muted)
|
* [muted](#muted)
|
||||||
@ -417,6 +418,14 @@ headers={{
|
|||||||
|
|
||||||
Platforms: Android ExoPlayer
|
Platforms: Android ExoPlayer
|
||||||
|
|
||||||
|
#### hideShutterView
|
||||||
|
Controls whether the ExoPlayer shutter view (black screen while loading) is enabled.
|
||||||
|
|
||||||
|
* **false (default)** - Show shutter view
|
||||||
|
* **true** - Hide shutter view
|
||||||
|
|
||||||
|
Platforms: Android ExoPlayer
|
||||||
|
|
||||||
#### id
|
#### id
|
||||||
Set the DOM id element so you can use document.getElementById on web platforms. Accepts string values.
|
Set the DOM id element so you can use document.getElementById on web platforms. Accepts string values.
|
||||||
|
|
||||||
|
1
Video.js
1
Video.js
@ -383,6 +383,7 @@ Video.propTypes = {
|
|||||||
fullscreenOrientation: PropTypes.oneOf(['all','landscape','portrait']),
|
fullscreenOrientation: PropTypes.oneOf(['all','landscape','portrait']),
|
||||||
progressUpdateInterval: PropTypes.number,
|
progressUpdateInterval: PropTypes.number,
|
||||||
useTextureView: PropTypes.bool,
|
useTextureView: PropTypes.bool,
|
||||||
|
hideShutterView: PropTypes.bool,
|
||||||
onLoadStart: PropTypes.func,
|
onLoadStart: PropTypes.func,
|
||||||
onLoad: PropTypes.func,
|
onLoad: PropTypes.func,
|
||||||
onBuffer: PropTypes.func,
|
onBuffer: PropTypes.func,
|
||||||
|
@ -39,6 +39,7 @@ public final class ExoPlayerView extends FrameLayout {
|
|||||||
private ViewGroup.LayoutParams layoutParams;
|
private ViewGroup.LayoutParams layoutParams;
|
||||||
|
|
||||||
private boolean useTextureView = false;
|
private boolean useTextureView = false;
|
||||||
|
private boolean hideShutterView = false;
|
||||||
|
|
||||||
public ExoPlayerView(Context context) {
|
public ExoPlayerView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@ -106,6 +107,10 @@ public final class ExoPlayerView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateShutterViewVisibility() {
|
||||||
|
shutterView.setVisibility(this.hideShutterView ? View.INVISIBLE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and
|
* Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and
|
||||||
* {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous
|
* {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous
|
||||||
@ -161,6 +166,11 @@ public final class ExoPlayerView extends FrameLayout {
|
|||||||
updateSurfaceView();
|
updateSurfaceView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHideShutterView(boolean hideShutterView) {
|
||||||
|
this.hideShutterView = hideShutterView;
|
||||||
|
updateShutterViewVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
private final Runnable measureAndLayout = new Runnable() {
|
private final Runnable measureAndLayout = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -131,6 +131,7 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
private float mProgressUpdateInterval = 250.0f;
|
private float mProgressUpdateInterval = 250.0f;
|
||||||
private boolean playInBackground = false;
|
private boolean playInBackground = false;
|
||||||
private boolean useTextureView = false;
|
private boolean useTextureView = false;
|
||||||
|
private boolean hideShutterView = false;
|
||||||
private Map<String, String> requestHeaders;
|
private Map<String, String> requestHeaders;
|
||||||
// \ End props
|
// \ End props
|
||||||
|
|
||||||
@ -954,6 +955,10 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
exoPlayerView.setUseTextureView(useTextureView);
|
exoPlayerView.setUseTextureView(useTextureView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHideShutterView(boolean hideShutterView) {
|
||||||
|
exoPlayerView.setHideShutterView(hideShutterView);
|
||||||
|
}
|
||||||
|
|
||||||
public void setBufferConfig(int newMinBufferMs, int newMaxBufferMs, int newBufferForPlaybackMs, int newBufferForPlaybackAfterRebufferMs) {
|
public void setBufferConfig(int newMinBufferMs, int newMaxBufferMs, int newBufferForPlaybackMs, int newBufferForPlaybackAfterRebufferMs) {
|
||||||
minBufferMs = newMinBufferMs;
|
minBufferMs = newMinBufferMs;
|
||||||
maxBufferMs = newMaxBufferMs;
|
maxBufferMs = newMaxBufferMs;
|
||||||
|
@ -51,6 +51,7 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
|
|||||||
private static final String PROP_DISABLE_FOCUS = "disableFocus";
|
private static final String PROP_DISABLE_FOCUS = "disableFocus";
|
||||||
private static final String PROP_FULLSCREEN = "fullscreen";
|
private static final String PROP_FULLSCREEN = "fullscreen";
|
||||||
private static final String PROP_USE_TEXTURE_VIEW = "useTextureView";
|
private static final String PROP_USE_TEXTURE_VIEW = "useTextureView";
|
||||||
|
private static final String PROP_HIDE_SHUTTER_VIEW = "hideShutterView";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -220,6 +221,11 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
|
|||||||
videoView.setUseTextureView(useTextureView);
|
videoView.setUseTextureView(useTextureView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = PROP_HIDE_SHUTTER_VIEW, defaultBoolean = false)
|
||||||
|
public void setHideShutterView(final ReactExoplayerView videoView, final boolean hideShutterView) {
|
||||||
|
videoView.setHideShutterView(hideShutterView);
|
||||||
|
}
|
||||||
|
|
||||||
@ReactProp(name = PROP_BUFFER_CONFIG)
|
@ReactProp(name = PROP_BUFFER_CONFIG)
|
||||||
public void setBufferConfig(final ReactExoplayerView videoView, @Nullable ReadableMap bufferConfig) {
|
public void setBufferConfig(final ReactExoplayerView videoView, @Nullable ReadableMap bufferConfig) {
|
||||||
int minBufferMs = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
|
int minBufferMs = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
|
||||||
|
Loading…
Reference in New Issue
Block a user