mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Fix DefaultTimeBar glitches
The glitches were introduced in: https://github.com/google/ExoPlayer/commit/6c31e34528 The problem is that Listener.onEvents is called in a later looper iteration than the listener methods that were previously used. This created a gap on the main thread between the UI component dispatching a seek operation to the player, and onEvents being called to update the progress bar's position. At the start of this gap the progress bar is rendering the new position, but its position member variable is still set to the old position. If the progress bar is re-drawn by another message on the main thread within the gap, it will briefly show the old position until onEvents is called. There are multiple possible fixes to this, and the best one is probably to modify ListenerSet to remove the gap. That's high risk though, so for now we fix the flicker by always updating the progress immediately after the seek is dispatched, in addition to when onEvents is called. Issue: #9049 #minor-release PiperOrigin-RevId: 380678388
This commit is contained in:
parent
3d3ac623a6
commit
b1dda6a02a
3 changed files with 6 additions and 12 deletions
|
|
@ -45,6 +45,8 @@
|
|||
* Fix focusability of `StyledPlayerView` and `StyledPlayerControlView`
|
||||
popup menus on API levels prior to 26
|
||||
([#9061](https://github.com/google/ExoPlayer/issues/9061)).
|
||||
* Fix progress bar flickering immediately after the user seeks
|
||||
([#9049](https://github.com/google/ExoPlayer/pull/9049)).
|
||||
* Video:
|
||||
* Fix `IncorrectContextUseViolation` strict mode warning on Android 11
|
||||
([#8246](https://github.com/google/ExoPlayer/pull/8246)).
|
||||
|
|
|
|||
|
|
@ -1114,12 +1114,8 @@ public class PlayerControlView extends FrameLayout {
|
|||
} else {
|
||||
windowIndex = player.getCurrentWindowIndex();
|
||||
}
|
||||
boolean dispatched = seekTo(player, windowIndex, positionMs);
|
||||
if (!dispatched) {
|
||||
// The seek wasn't dispatched then the progress bar scrubber will be in the wrong position.
|
||||
// Trigger a progress update to snap it back.
|
||||
updateProgress();
|
||||
}
|
||||
seekTo(player, windowIndex, positionMs);
|
||||
updateProgress();
|
||||
}
|
||||
|
||||
private boolean seekTo(Player player, int windowIndex, long positionMs) {
|
||||
|
|
|
|||
|
|
@ -1519,12 +1519,8 @@ public class StyledPlayerControlView extends FrameLayout {
|
|||
} else {
|
||||
windowIndex = player.getCurrentWindowIndex();
|
||||
}
|
||||
boolean dispatched = seekTo(player, windowIndex, positionMs);
|
||||
if (!dispatched) {
|
||||
// The seek wasn't dispatched then the progress bar scrubber will be in the wrong position.
|
||||
// Trigger a progress update to snap it back.
|
||||
updateProgress();
|
||||
}
|
||||
seekTo(player, windowIndex, positionMs);
|
||||
updateProgress();
|
||||
}
|
||||
|
||||
private boolean seekTo(Player player, int windowIndex, long positionMs) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue