androidx / androidx/media

getCurrentPosition is not strictly monotonic while playing

Open
#1,578 13 comments 0 reactions 1 assignee View on GitHub

@tianyif is already working on this.

Since Jul 31, 2024.

bug needs triage
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 1.4.0

More version details

No response

Devices that reproduce the issue

Pixel 7 Pro (Android 14)

Devices that do not reproduce the issue

I assume none of them.

Reproducible in the demo app?

Not tested

Reproduction steps

I'm playing an MP4 audio while polling getCurrentPosition periodically to update the position, but I'm seeing some unexpected backward jump at around 3 seconds - the audio is playing fine - only the current position value seems wrong causing some unexpected UI glitches. It only seems to happen once, 3 seconds after playing started.

Confirmed using some debug traces:

position: 2.901s
position: 2.917s
position: 2.934s
position: 2.951s
position: 2.853s <--- here
position: 2.87s
position: 2.887s
position: 2.903s
position: 2.92s
position: 2.938s
position: 2.956s
position: 2.975s
Expected result

getCurrentPosition should be strictly monotonic during playing.

Actual result

getCurrentPosition randomly jumps backward.

Media

https://github.com/user-attachments/assets/65cf585e-a5b2-4920-966d-ac6b45a403fa

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.