From cd75e72180b6424f5c0dd2b4fbdbd9dc7773ce94 Mon Sep 17 00:00:00 2001 From: Bryan van Wijk Date: Thu, 2 Aug 2018 09:20:08 +0200 Subject: [PATCH] Rename to bufferConfig and use stopPlayback --- README.md | 9 ++--- Video.js | 2 +- .../exoplayer/ReactExoplayerView.java | 13 ++++--- .../exoplayer/ReactExoplayerViewManager.java | 34 +++++++++---------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 3b721e58..f9c49879 100644 --- a/README.md +++ b/README.md @@ -480,8 +480,9 @@ Adjust the volume. Platforms: all -#### loadControl -Adjust the load control parameters: minBufferMs, maxBufferMs, bufferForPlaybackMs and playbackAfterRebufferMs. +#### bufferConfig +Adjust the video load control parameters: minBufferMs, maxBufferMs, bufferForPlaybackMs and playbackAfterRebufferMs. +Note: these values can not be changed after the video component is loaded. Property | Description --- | --- @@ -491,7 +492,7 @@ bufferForPlaybackMs | The default duration of media that must be buffered for pl playbackAfterRebufferMs | The default duration of media that must be buffered for playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by buffer depletion rather than a user action. ``` -loadControl={{ +bufferConfig={{ minBufferMs: number, maxBufferMs: number, bufferForPlaybackMs: number, @@ -501,7 +502,7 @@ loadControl={{ Example with default values: ``` -loadControl={{ +bufferConfig={{ minBufferMs: 15000, maxBufferMs: 50000, bufferForPlaybackMs: 2500, diff --git a/Video.js b/Video.js index 14401078..5c6cd1d3 100644 --- a/Video.js +++ b/Video.js @@ -345,7 +345,7 @@ Video.propTypes = { paused: PropTypes.bool, muted: PropTypes.bool, volume: PropTypes.number, - loadControl: PropTypes.shape({ + bufferConfig: PropTypes.shape({ minBufferMs: PropTypes.number, maxBufferMs: PropTypes.number, bufferForPlaybackMs: PropTypes.number, diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 878ed261..60f74416 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -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(); } } diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java index 9611a960..88839432 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java @@ -39,11 +39,11 @@ public class ReactExoplayerViewManager extends ViewGroupManager