mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Estimate content position when playWhenReady never has changed
This change closes an edge case when an app is connecting a controller to a session that is already playing. In such a case `MediaControllerImplBase.getContentPosition()` keeps returning the first estimation for every call until `playWhenReady` changes for the first time. Reproduction: Launch the demo-session app and start audio playback. Put the activity to the background and then to the foreground again. Go to the playlist view and `PlayerActivity` without interrupting playback and try to seek in the timebar. The position is stuck and snaps back. PiperOrigin-RevId: 422795360
This commit is contained in:
parent
e77417b004
commit
491ac8f066
1 changed files with 1 additions and 2 deletions
|
|
@ -677,8 +677,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
@Override
|
||||
public long getContentPosition() {
|
||||
boolean receivedUpdatedPositionInfo =
|
||||
lastSetPlayWhenReadyCalledTimeMs != C.TIME_UNSET
|
||||
&& lastSetPlayWhenReadyCalledTimeMs < playerInfo.sessionPositionInfo.eventTimeMs;
|
||||
lastSetPlayWhenReadyCalledTimeMs < playerInfo.sessionPositionInfo.eventTimeMs;
|
||||
if (!playerInfo.isPlaying || playerInfo.sessionPositionInfo.isPlayingAd) {
|
||||
if (receivedUpdatedPositionInfo || lastReturnedContentPositionMs == C.TIME_UNSET) {
|
||||
lastReturnedContentPositionMs =
|
||||
|
|
|
|||
Loading…
Reference in a new issue