Remove buffer progress event
This commit is contained in:
parent
e90ab21c91
commit
8a057c553b
@ -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)
|
- 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)
|
- 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)
|
- 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)
|
- 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)
|
- 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)
|
- Add support for L1 to L3 Widevine fallback if playback fails initially. [#2689](https://github.com/react-native-video/react-native-video/pull/2689)
|
||||||
|
12
README.md
12
README.md
@ -376,7 +376,6 @@ var styles = StyleSheet.create({
|
|||||||
|--|--|
|
|--|--|
|
||||||
|[onAudioBecomingNoisy](#onaudiobecomingnoisy)|Android ExoPlayer, iOS|
|
|[onAudioBecomingNoisy](#onaudiobecomingnoisy)|Android ExoPlayer, iOS|
|
||||||
|[onBandwidthUpdate](#onbandwidthupdate)|Android ExoPlayer|
|
|[onBandwidthUpdate](#onbandwidthupdate)|Android ExoPlayer|
|
||||||
|[onBufferProgress](#onbufferprogress)|Android ExopPlater|
|
|
||||||
|[onBuffer](#onbuffer)|Android ExoPlayer, iOS|
|
|[onBuffer](#onbuffer)|Android ExoPlayer, iOS|
|
||||||
|[onEnd](#onend)|All|
|
|[onEnd](#onend)|All|
|
||||||
|[onExternalPlaybackChange](#onexternalplaybackchange)|iOS|
|
|[onExternalPlaybackChange](#onexternalplaybackchange)|iOS|
|
||||||
@ -1035,17 +1034,6 @@ Note: On Android ExoPlayer, you must set the [reportBandwidth](#reportbandwidth)
|
|||||||
|
|
||||||
Platforms: Android ExoPlayer
|
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
|
#### onBuffer
|
||||||
Callback function that is called when the player buffers.
|
Callback function that is called when the player buffers.
|
||||||
|
|
||||||
|
7
Video.js
7
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) => {
|
_onGetLicense = (event) => {
|
||||||
if (this.props.drm && this.props.drm.getLicense instanceof Function) {
|
if (this.props.drm && this.props.drm.getLicense instanceof Function) {
|
||||||
const data = event.nativeEvent;
|
const data = event.nativeEvent;
|
||||||
@ -326,7 +320,6 @@ export default class Video extends Component {
|
|||||||
onVideoSeek: this._onSeek,
|
onVideoSeek: this._onSeek,
|
||||||
onVideoEnd: this._onEnd,
|
onVideoEnd: this._onEnd,
|
||||||
onVideoBuffer: this._onBuffer,
|
onVideoBuffer: this._onBuffer,
|
||||||
onVideoBufferProgress: this._onBufferProgress,
|
|
||||||
onVideoBandwidthUpdate: this._onBandwidthUpdate,
|
onVideoBandwidthUpdate: this._onBandwidthUpdate,
|
||||||
onTimedMetadata: this._onTimedMetadata,
|
onTimedMetadata: this._onTimedMetadata,
|
||||||
onVideoAudioBecomingNoisy: this._onAudioBecomingNoisy,
|
onVideoAudioBecomingNoisy: this._onAudioBecomingNoisy,
|
||||||
|
@ -169,7 +169,6 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
private double minBackBufferMemoryReservePercent = ReactExoplayerView.DEFAULT_MIN_BACK_BUFFER_MEMORY_RESERVE;
|
private double minBackBufferMemoryReservePercent = ReactExoplayerView.DEFAULT_MIN_BACK_BUFFER_MEMORY_RESERVE;
|
||||||
private double minBufferMemoryReservePercent = ReactExoplayerView.DEFAULT_MIN_BUFFER_MEMORY_RESERVE;
|
private double minBufferMemoryReservePercent = ReactExoplayerView.DEFAULT_MIN_BUFFER_MEMORY_RESERVE;
|
||||||
private Handler mainHandler;
|
private Handler mainHandler;
|
||||||
private Timer bufferCheckTimer;
|
|
||||||
|
|
||||||
// Props from React
|
// Props from React
|
||||||
private int backBufferDurationMs = DefaultLoadControl.DEFAULT_BACK_BUFFER_DURATION_MS;
|
private int backBufferDurationMs = DefaultLoadControl.DEFAULT_BACK_BUFFER_DURATION_MS;
|
||||||
@ -477,36 +476,6 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
VideoEventEmitter eventEmitter = this.eventEmitter;
|
VideoEventEmitter eventEmitter = this.eventEmitter;
|
||||||
Handler mainHandler = this.mainHandler;
|
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() {
|
private void initializePlayer() {
|
||||||
@ -779,7 +748,6 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
|
|
||||||
private void releasePlayer() {
|
private void releasePlayer() {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
stopBufferCheckTimer();
|
|
||||||
updateResumePosition();
|
updateResumePosition();
|
||||||
player.release();
|
player.release();
|
||||||
player.removeMetadataOutput(this);
|
player.removeMetadataOutput(this);
|
||||||
|
@ -45,7 +45,6 @@ class VideoEventEmitter {
|
|||||||
private static final String EVENT_READY = "onReadyForDisplay";
|
private static final String EVENT_READY = "onReadyForDisplay";
|
||||||
private static final String EVENT_BUFFER = "onVideoBuffer";
|
private static final String EVENT_BUFFER = "onVideoBuffer";
|
||||||
private static final String EVENT_PLAYBACK_STATE_CHANGED = "onVideoPlaybackStateChanged";
|
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_IDLE = "onVideoIdle";
|
||||||
private static final String EVENT_TIMED_METADATA = "onTimedMetadata";
|
private static final String EVENT_TIMED_METADATA = "onTimedMetadata";
|
||||||
private static final String EVENT_AUDIO_BECOMING_NOISY = "onVideoAudioBecomingNoisy";
|
private static final String EVENT_AUDIO_BECOMING_NOISY = "onVideoAudioBecomingNoisy";
|
||||||
@ -225,13 +224,6 @@ class VideoEventEmitter {
|
|||||||
receiveEvent(EVENT_PLAYBACK_STATE_CHANGED, map);
|
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() {
|
void idle() {
|
||||||
receiveEvent(EVENT_IDLE, null);
|
receiveEvent(EVENT_IDLE, null);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user