fix(android): seek callback with controls (#3694)
* fix(ts): onPlaybackRateChangeData was not correctly typed * fix: ensure tracks are well displayed in the sample * fix(android): add onSeek callback when controls are enable * chore: remove seekTime which is useless now
This commit is contained in:
parent
20d398608a
commit
c730306e3a
@ -185,7 +185,6 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
private float audioVolume = 1f;
|
private float audioVolume = 1f;
|
||||||
private int minLoadRetryCount = 3;
|
private int minLoadRetryCount = 3;
|
||||||
private int maxBitRate = 0;
|
private int maxBitRate = 0;
|
||||||
private long seekTime = C.TIME_UNSET;
|
|
||||||
private boolean hasDrmFailed = false;
|
private boolean hasDrmFailed = false;
|
||||||
private boolean isUsingContentResolution = false;
|
private boolean isUsingContentResolution = false;
|
||||||
private boolean selectTrackWhenReady = false;
|
private boolean selectTrackWhenReady = false;
|
||||||
@ -1380,7 +1379,15 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositionDiscontinuity(@NonNull Player.PositionInfo oldPosition, @NonNull Player.PositionInfo newPosition, int reason) {
|
public void onPositionDiscontinuity(@NonNull Player.PositionInfo oldPosition, @NonNull Player.PositionInfo newPosition, @Player.DiscontinuityReason int reason) {
|
||||||
|
if (reason == Player.DISCONTINUITY_REASON_SEEK) {
|
||||||
|
eventEmitter.seek(player.getCurrentPosition(), newPosition.positionMs % 1000); // time are in seconds /°\
|
||||||
|
if (isUsingContentResolution) {
|
||||||
|
// We need to update the selected track to make sure that it still matches user selection if track list has changed in this period
|
||||||
|
setSelectedTrack(C.TRACK_TYPE_VIDEO, videoTrackType, videoTrackValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (playerNeedsSource) {
|
if (playerNeedsSource) {
|
||||||
// This will only occur if the user has performed a seek whilst in the error state. Update the
|
// This will only occur if the user has performed a seek whilst in the error state. Update the
|
||||||
// resume position so that if the user then retries, playback will resume from the position to
|
// resume position so that if the user then retries, playback will resume from the position to
|
||||||
@ -1405,28 +1412,6 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlaybackStateChanged(int playbackState) {
|
|
||||||
if (playbackState == Player.STATE_READY && seekTime != C.TIME_UNSET) {
|
|
||||||
eventEmitter.seek(player.getCurrentPosition(), seekTime);
|
|
||||||
seekTime = C.TIME_UNSET;
|
|
||||||
if (isUsingContentResolution) {
|
|
||||||
// We need to update the selected track to make sure that it still matches user selection if track list has changed in this period
|
|
||||||
setSelectedTrack(C.TRACK_TYPE_VIDEO, videoTrackType, videoTrackValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRepeatModeChanged(int repeatMode) {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTracksChanged(@NonNull Tracks tracks) {
|
public void onTracksChanged(@NonNull Tracks tracks) {
|
||||||
eventEmitter.textTracks(getTextTrackInfo());
|
eventEmitter.textTracks(getTextTrackInfo());
|
||||||
@ -1900,7 +1885,6 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
|
|
||||||
public void seekTo(long positionMs) {
|
public void seekTo(long positionMs) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
seekTime = positionMs;
|
|
||||||
player.seekTo(positionMs);
|
player.seekTo(positionMs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user