Skip to content

fix(player): fix Android 17 lockscreen playback and SABR seek buffering#70

Open
Priveetee wants to merge 1 commit into
InfinityLoop1308:devfrom
Priveetee:fix/2575-lockscreen-sabr-seek
Open

fix(player): fix Android 17 lockscreen playback and SABR seek buffering#70
Priveetee wants to merge 1 commit into
InfinityLoop1308:devfrom
Priveetee:fix/2575-lockscreen-sabr-seek

Conversation

@Priveetee

Copy link
Copy Markdown
Contributor

Fixes InfinityLoop1308/PipePipe#2575

Pairs with the extractor-side SABR cold-start fix: InfinityLoop1308/PipePipeExtractor#80

Summary

I reproduced the lockscreen/background issue on my Pixel 8 / Android 17.

There were two problems here:

  • Android 17 could lose the proper foreground/media playback state after notification updates.
  • SABR could keep an old reader position after a lockscreen MediaSession seek, so seeking forward could leave the player buffering forever.

Problem

After startForeground(), later notification updates could go through notify() instead of keeping the service foreground notification updated through startForeground().

For SABR, lockscreen seek can call seekToUs() without a new track selection. That means ExoPlayer starts asking for the new segment, but SABR was still pacing from the previous reader position.

Observed during repro:

MediaSession seek -> position around 296s
SABR waiting for a later audio segment
readerHead still around the old position
player stuck in BUFFERING

Changes

  • Keep notification updates tied to startForeground() while the player service is alive.
  • Dispose a stale media session before creating a new one.
  • Track the currently active SABR audio/video tracks in SabrMediaPeriod.
  • Prepare the SABR session position from seekToUs(), not only from track selection.

Validation

Tested on Pixel 8 / Android 17:

  • foreground playback
  • background audio
  • lockscreen play/pause
  • lockscreen seek backward
  • lockscreen seek forward
  • queue transition after lockscreen seek

Build:

  • ./gradlew :app:assembleDebug
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Background play audio drops a few seconds after minimizing the app

1 participant