Merge pull request #3179 from vemarav/shuttercolor
Android: fixes black splashes
This commit is contained in:
commit
90fe971dee
12
API.md
12
API.md
@ -331,6 +331,7 @@ var styles = StyleSheet.create({
|
|||||||
| [selectedAudioTrack](#selectedaudiotrack) | Android, iOS |
|
| [selectedAudioTrack](#selectedaudiotrack) | Android, iOS |
|
||||||
| [selectedTextTrack](#selectedtexttrack) | Android, iOS |
|
| [selectedTextTrack](#selectedtexttrack) | Android, iOS |
|
||||||
| [selectedVideoTrack](#selectedvideotrack) | Android |
|
| [selectedVideoTrack](#selectedvideotrack) | Android |
|
||||||
|
| [shutterColor](#shutterColor) | Android |
|
||||||
| [source](#source) | All |
|
| [source](#source) | All |
|
||||||
| [subtitleStyle](#subtitleStyle) | Android |
|
| [subtitleStyle](#subtitleStyle) | Android |
|
||||||
| [textTracks](#texttracks) | Android, iOS |
|
| [textTracks](#texttracks) | Android, iOS |
|
||||||
@ -852,6 +853,17 @@ If a track matching the specified Type (and Value if appropriate) is unavailable
|
|||||||
|
|
||||||
Platforms: Android
|
Platforms: Android
|
||||||
|
|
||||||
|
#### shutterColor
|
||||||
|
Apply color to shutter view, if you see black flashes before video start then set
|
||||||
|
|
||||||
|
```
|
||||||
|
shutterColor='transparent'
|
||||||
|
```
|
||||||
|
|
||||||
|
- black (default)
|
||||||
|
|
||||||
|
Platforms: Android
|
||||||
|
|
||||||
#### source
|
#### source
|
||||||
Sets the media source. You can pass an asset loaded via require or an object with a uri.
|
Sets the media source. You can pass an asset loaded via require or an object with a uri.
|
||||||
|
|
||||||
|
1
Video.js
1
Video.js
@ -528,6 +528,7 @@ Video.propTypes = {
|
|||||||
useTextureView: PropTypes.bool,
|
useTextureView: PropTypes.bool,
|
||||||
useSecureView: PropTypes.bool,
|
useSecureView: PropTypes.bool,
|
||||||
hideShutterView: PropTypes.bool,
|
hideShutterView: PropTypes.bool,
|
||||||
|
shutterColor: PropTypes.string,
|
||||||
onLoadStart: PropTypes.func,
|
onLoadStart: PropTypes.func,
|
||||||
onPlaybackStateChanged: PropTypes.func,
|
onPlaybackStateChanged: PropTypes.func,
|
||||||
onLoad: PropTypes.func,
|
onLoad: PropTypes.func,
|
||||||
|
@ -116,6 +116,10 @@ public final class ExoPlayerView extends FrameLayout implements AdViewProvider {
|
|||||||
subtitleLayout.setPadding(style.getPaddingLeft(), style.getPaddingTop(), style.getPaddingRight(), style.getPaddingBottom());
|
subtitleLayout.setPadding(style.getPaddingLeft(), style.getPaddingTop(), style.getPaddingRight(), style.getPaddingBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setShutterColor(Integer color) {
|
||||||
|
shutterView.setBackgroundColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateSurfaceView() {
|
private void updateSurfaceView() {
|
||||||
View view;
|
View view;
|
||||||
if (!useTextureView || useSecureView) {
|
if (!useTextureView || useSecureView) {
|
||||||
|
@ -2039,6 +2039,10 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
exoPlayerView.setSubtitleStyle(style);
|
exoPlayerView.setSubtitleStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setShutterColor(Integer color) {
|
||||||
|
exoPlayerView.setShutterColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAdEvent(AdEvent adEvent) {
|
public void onAdEvent(AdEvent adEvent) {
|
||||||
eventEmitter.receiveAdEvent(adEvent.getType().name());
|
eventEmitter.receiveAdEvent(adEvent.getType().name());
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.brentvatne.exoplayer;
|
package com.brentvatne.exoplayer;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.facebook.react.bridge.Dynamic;
|
import com.facebook.react.bridge.Dynamic;
|
||||||
import com.facebook.react.bridge.ReadableArray;
|
import com.facebook.react.bridge.ReadableArray;
|
||||||
@ -13,7 +13,6 @@ import com.facebook.react.common.MapBuilder;
|
|||||||
import com.facebook.react.uimanager.ThemedReactContext;
|
import com.facebook.react.uimanager.ThemedReactContext;
|
||||||
import com.facebook.react.uimanager.ViewGroupManager;
|
import com.facebook.react.uimanager.ViewGroupManager;
|
||||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||||
import com.facebook.react.bridge.ReactMethod;
|
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import com.google.android.exoplayer2.DefaultLoadControl;
|
import com.google.android.exoplayer2.DefaultLoadControl;
|
||||||
import com.google.android.exoplayer2.upstream.RawResourceDataSource;
|
import com.google.android.exoplayer2.upstream.RawResourceDataSource;
|
||||||
@ -81,8 +80,8 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
|
|||||||
private static final String PROP_SELECTED_VIDEO_TRACK_VALUE = "value";
|
private static final String PROP_SELECTED_VIDEO_TRACK_VALUE = "value";
|
||||||
private static final String PROP_HIDE_SHUTTER_VIEW = "hideShutterView";
|
private static final String PROP_HIDE_SHUTTER_VIEW = "hideShutterView";
|
||||||
private static final String PROP_CONTROLS = "controls";
|
private static final String PROP_CONTROLS = "controls";
|
||||||
|
|
||||||
private static final String PROP_SUBTITLE_STYLE = "subtitleStyle";
|
private static final String PROP_SUBTITLE_STYLE = "subtitleStyle";
|
||||||
|
private static final String PROP_SHUTTER_COLOR = "shutterColor";
|
||||||
|
|
||||||
private ReactExoplayerConfig config;
|
private ReactExoplayerConfig config;
|
||||||
|
|
||||||
@ -378,6 +377,11 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
|
|||||||
videoView.setSubtitleStyle(SubtitleStyle.parse(src));
|
videoView.setSubtitleStyle(SubtitleStyle.parse(src));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = PROP_SHUTTER_COLOR, customType = "Color")
|
||||||
|
public void setShutterColor(final ReactExoplayerView videoView, final Integer color) {
|
||||||
|
videoView.setShutterColor(color == null ? Color.BLACK : color);
|
||||||
|
}
|
||||||
|
|
||||||
@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