diff --git a/CHANGELOG.md b/CHANGELOG.md index b5425575..f16fc2f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,6 @@ - Add support for customising back buffer duration and handle network errors gracefully to prevent releasing the player when network is lost. [#2689](https://github.com/react-native-video/react-native-video/pull/2689) - Allow player to be init before source is provided, and later update once a source is provided. [#2689](https://github.com/react-native-video/react-native-video/pull/2689) - Adds handling for providing a empty source in order to stop playback and clear out any existing content [#2689](https://github.com/react-native-video/react-native-video/pull/2689) -- Add support for onBufferProgress prop on Android to get buffer data even when the player is paused. [#2689](https://github.com/react-native-video/react-native-video/pull/2689) - Add support for detecting if format is supported and exclude unsupported resolutions from auto quality selection and video track info in RN. [#2689](https://github.com/react-native-video/react-native-video/pull/2689) - Improve error handling [#2689](https://github.com/react-native-video/react-native-video/pull/2689) - Add support for L1 to L3 Widevine fallback if playback fails initially. [#2689](https://github.com/react-native-video/react-native-video/pull/2689) diff --git a/README.md b/README.md index a60ddeb5..998d7ded 100644 --- a/README.md +++ b/README.md @@ -376,7 +376,6 @@ var styles = StyleSheet.create({ |--|--| |[onAudioBecomingNoisy](#onaudiobecomingnoisy)|Android ExoPlayer, iOS| |[onBandwidthUpdate](#onbandwidthupdate)|Android ExoPlayer| -|[onBufferProgress](#onbufferprogress)|Android ExopPlater| |[onBuffer](#onbuffer)|Android ExoPlayer, iOS| |[onEnd](#onend)|All| |[onExternalPlaybackChange](#onexternalplaybackchange)|iOS| @@ -1035,17 +1034,6 @@ Note: On Android ExoPlayer, you must set the [reportBandwidth](#reportbandwidth) Platforms: Android ExoPlayer -#### onBufferProgress -Callback function that is called on a set interval which contains the buffer start and end position in ms. - -Payload: -Property | Type | Description ---- | --- | --- -start | number | The buffer start (ms) -end | number | The buffer end (ms) - -Platforms: Android ExoPlayer - #### onBuffer Callback function that is called when the player buffers. diff --git a/Video.js b/Video.js index dd70750e..7ff55565 100644 --- a/Video.js +++ b/Video.js @@ -239,12 +239,6 @@ export default class Video extends Component { } }; - _onBufferProgress = (event) => { - if (this.props.onBufferProgress) { - this.props.onBufferProgress(event.nativeEvent); - } - }; - _onGetLicense = (event) => { if (this.props.drm && this.props.drm.getLicense instanceof Function) { const data = event.nativeEvent; @@ -326,7 +320,6 @@ export default class Video extends Component { onVideoSeek: this._onSeek, onVideoEnd: this._onEnd, onVideoBuffer: this._onBuffer, - onVideoBufferProgress: this._onBufferProgress, onVideoBandwidthUpdate: this._onBandwidthUpdate, onTimedMetadata: this._onTimedMetadata, onVideoAudioBecomingNoisy: this._onAudioBecomingNoisy, 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 3eb6c9c1..314345bb 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -169,7 +169,6 @@ class ReactExoplayerView extends FrameLayout implements private double minBackBufferMemoryReservePercent = ReactExoplayerView.DEFAULT_MIN_BACK_BUFFER_MEMORY_RESERVE; private double minBufferMemoryReservePercent = ReactExoplayerView.DEFAULT_MIN_BUFFER_MEMORY_RESERVE; private Handler mainHandler; - private Timer bufferCheckTimer; // Props from React private int backBufferDurationMs = DefaultLoadControl.DEFAULT_BACK_BUFFER_DURATION_MS; @@ -477,36 +476,6 @@ class ReactExoplayerView extends FrameLayout implements VideoEventEmitter eventEmitter = this.eventEmitter; Handler mainHandler = this.mainHandler; - if (this.bufferCheckTimer != null) { - this.stopBufferCheckTimer(); - } - - this.bufferCheckTimer = new Timer(); - TimerTask bufferCheckTimerTask = new TimerTask() { - @Override - public void run() { - if (mainHandler != null) { - mainHandler.post(new Runnable() { - public void run() { - if (player != null) { - double bufferedDuration = (double) (player.getBufferedPercentage() * player.getDuration() / 100); - eventEmitter.bufferProgress(0d, bufferedDuration); - } - } - }); - } - }; - }; - - this.bufferCheckTimer.scheduleAtFixedRate(bufferCheckTimerTask, 500, 1000); - } - - private void stopBufferCheckTimer() { - if (this.bufferCheckTimer == null) { - return; - } - this.bufferCheckTimer.cancel(); - this.bufferCheckTimer = null; } private void initializePlayer() { @@ -779,7 +748,6 @@ class ReactExoplayerView extends FrameLayout implements private void releasePlayer() { if (player != null) { - stopBufferCheckTimer(); updateResumePosition(); player.release(); player.removeMetadataOutput(this); diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java index 5aeb09ce..da691bb5 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java @@ -45,7 +45,6 @@ class VideoEventEmitter { private static final String EVENT_READY = "onReadyForDisplay"; private static final String EVENT_BUFFER = "onVideoBuffer"; private static final String EVENT_PLAYBACK_STATE_CHANGED = "onVideoPlaybackStateChanged"; - private static final String EVENT_BUFFER_PROGRESS = "onVideoBufferProgress"; private static final String EVENT_IDLE = "onVideoIdle"; private static final String EVENT_TIMED_METADATA = "onTimedMetadata"; private static final String EVENT_AUDIO_BECOMING_NOISY = "onVideoAudioBecomingNoisy"; @@ -225,13 +224,6 @@ class VideoEventEmitter { receiveEvent(EVENT_PLAYBACK_STATE_CHANGED, map); } - void bufferProgress(double start, double end) { - WritableMap map = Arguments.createMap(); - map.putDouble(EVENT_PROP_BUFFER_START, start); - map.putDouble(EVENT_PROP_BUFFER_END, end); - receiveEvent(EVENT_BUFFER_PROGRESS, map); - } - void idle() { receiveEvent(EVENT_IDLE, null); }