mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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
|
@Override
|
||||||
public long getContentPosition() {
|
public long getContentPosition() {
|
||||||
boolean receivedUpdatedPositionInfo =
|
boolean receivedUpdatedPositionInfo =
|
||||||
lastSetPlayWhenReadyCalledTimeMs != C.TIME_UNSET
|
lastSetPlayWhenReadyCalledTimeMs < playerInfo.sessionPositionInfo.eventTimeMs;
|
||||||
&& lastSetPlayWhenReadyCalledTimeMs < playerInfo.sessionPositionInfo.eventTimeMs;
|
|
||||||
if (!playerInfo.isPlaying || playerInfo.sessionPositionInfo.isPlayingAd) {
|
if (!playerInfo.isPlaying || playerInfo.sessionPositionInfo.isPlayingAd) {
|
||||||
if (receivedUpdatedPositionInfo || lastReturnedContentPositionMs == C.TIME_UNSET) {
|
if (receivedUpdatedPositionInfo || lastReturnedContentPositionMs == C.TIME_UNSET) {
|
||||||
lastReturnedContentPositionMs =
|
lastReturnedContentPositionMs =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue