Rename to bufferConfig and use stopPlayback
This commit is contained in:
@@ -940,13 +940,12 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
exoPlayerView.setUseTextureView(useTextureView);
|
||||
}
|
||||
|
||||
public void setLoadControl(int newMinBufferMs, int newMaxBufferMs, int newBufferForPlaybackMs, int newBufferForPlaybackAfterRebufferMs) {
|
||||
player.release();
|
||||
this.player = null;
|
||||
this.minBufferMs = newMinBufferMs;
|
||||
this.maxBufferMs = newMaxBufferMs;
|
||||
this.bufferForPlaybackMs = newBufferForPlaybackMs;
|
||||
this.bufferForPlaybackAfterRebufferMs = newBufferForPlaybackAfterRebufferMs;
|
||||
public void setBufferConfig(int newMinBufferMs, int newMaxBufferMs, int newBufferForPlaybackMs, int newBufferForPlaybackAfterRebufferMs) {
|
||||
stopPlayback();
|
||||
minBufferMs = newMinBufferMs;
|
||||
maxBufferMs = newMaxBufferMs;
|
||||
bufferForPlaybackMs = newBufferForPlaybackMs;
|
||||
bufferForPlaybackAfterRebufferMs = newBufferForPlaybackAfterRebufferMs;
|
||||
initializePlayer();
|
||||
}
|
||||
}
|
||||
|
@@ -39,11 +39,11 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
|
||||
private static final String PROP_PAUSED = "paused";
|
||||
private static final String PROP_MUTED = "muted";
|
||||
private static final String PROP_VOLUME = "volume";
|
||||
private static final String PROP_LOAD_CONTROL = "loadControl";
|
||||
private static final String PROP_LOAD_CONTROL_MIN_BUFFER_MS = "minBufferMs";
|
||||
private static final String PROP_LOAD_CONTROL_MAX_BUFFER_MS = "maxBufferMs";
|
||||
private static final String PROP_LOAD_CONTROL_BUFFER_FOR_PLAYBACK_MS = "bufferForPlaybackMs";
|
||||
private static final String PROP_LOAD_CONTROL_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS = "bufferForPlaybackAfterRebufferMs";
|
||||
private static final String PROP_BUFFER_CONFIG = "bufferConfig";
|
||||
private static final String PROP_BUFFER_CONFIG_MIN_BUFFER_MS = "minBufferMs";
|
||||
private static final String PROP_BUFFER_CONFIG_MAX_BUFFER_MS = "maxBufferMs";
|
||||
private static final String PROP_BUFFER_CONFIG_BUFFER_FOR_PLAYBACK_MS = "bufferForPlaybackMs";
|
||||
private static final String PROP_BUFFER_CONFIG_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS = "bufferForPlaybackAfterRebufferMs";
|
||||
private static final String PROP_PROGRESS_UPDATE_INTERVAL = "progressUpdateInterval";
|
||||
private static final String PROP_SEEK = "seek";
|
||||
private static final String PROP_RATE = "rate";
|
||||
@@ -220,22 +220,22 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
|
||||
videoView.setUseTextureView(useTextureView);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_LOAD_CONTROL)
|
||||
public void setLoadControl(final ReactExoplayerView videoView, @Nullable ReadableMap loadControl) {
|
||||
@ReactProp(name = PROP_BUFFER_CONFIG )
|
||||
public void setBufferConfig(final ReactExoplayerView videoView, @Nullable ReadableMap bufferConfig) {
|
||||
int minBufferMs = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
|
||||
int maxBufferMs = DefaultLoadControl.DEFAULT_MAX_BUFFER_MS;
|
||||
int bufferForPlaybackMs = DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS;
|
||||
int bufferForPlaybackAfterRebufferMs = DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS;
|
||||
if (loadControl != null) {
|
||||
minBufferMs = loadControl.hasKey(PROP_LOAD_CONTROL_MIN_BUFFER_MS)
|
||||
? loadControl.getInt(PROP_LOAD_CONTROL_MIN_BUFFER_MS) : minBufferMs;
|
||||
maxBufferMs = loadControl.hasKey(PROP_LOAD_CONTROL_MAX_BUFFER_MS)
|
||||
? loadControl.getInt(PROP_LOAD_CONTROL_MAX_BUFFER_MS) : maxBufferMs;
|
||||
bufferForPlaybackMs = loadControl.hasKey(PROP_LOAD_CONTROL_BUFFER_FOR_PLAYBACK_MS)
|
||||
? loadControl.getInt(PROP_LOAD_CONTROL_BUFFER_FOR_PLAYBACK_MS) : bufferForPlaybackMs;
|
||||
bufferForPlaybackAfterRebufferMs = loadControl.hasKey(PROP_LOAD_CONTROL_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS)
|
||||
? loadControl.getInt(PROP_LOAD_CONTROL_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS) : bufferForPlaybackAfterRebufferMs;
|
||||
videoView.setLoadControl(minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs);
|
||||
if (bufferConfig != null) {
|
||||
minBufferMs = bufferConfig.hasKey(PROP_BUFFER_CONFIG_MIN_BUFFER_MS)
|
||||
? bufferConfig.getInt(PROP_BUFFER_CONFIG_MIN_BUFFER_MS) : minBufferMs;
|
||||
maxBufferMs = bufferConfig.hasKey(PROP_BUFFER_CONFIG_MAX_BUFFER_MS)
|
||||
? bufferConfig.getInt(PROP_BUFFER_CONFIG_MAX_BUFFER_MS) : maxBufferMs;
|
||||
bufferForPlaybackMs = bufferConfig.hasKey(PROP_BUFFER_CONFIG_BUFFER_FOR_PLAYBACK_MS)
|
||||
? bufferConfig.getInt(PROP_BUFFER_CONFIG_BUFFER_FOR_PLAYBACK_MS) : bufferForPlaybackMs;
|
||||
bufferForPlaybackAfterRebufferMs = bufferConfig.hasKey(PROP_BUFFER_CONFIG_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS)
|
||||
? bufferConfig.getInt(PROP_BUFFER_CONFIG_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS) : bufferForPlaybackAfterRebufferMs;
|
||||
videoView.setBufferConfig(minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user