androidx / androidx/media

OnTimelineChanged skips mediaItems and messes up video duration when using a concatenated mediaSource

Open
#1,990 6 comments 0 reactions 1 assignee View on GitHub

@tianyif is already working on this.

Since Dec 23, 2024.

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

Description

Version

Media3 1.5.1

More version details

Bug is also reproducible in version 1.4.1

Devices that reproduce the issue

Any android device should be able to do so, however I used a Pixel 4a and RealMe devices to test.

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

In the code save the current position of the exoplayer on orientation change. When all the concatenated mediaSources are finished (Player.Listener's onTimeLineChanged gets called for each one added), we seekTo the position.
1.) Concatenate several video MediaSources together using ConcatenatingMediaSource2.Builder
2.) Set Exoplayer's MediaSource to the resulting concatenation above
2.5.) Keep doing this until the resulting video is at least twenty seconds long
3.) Scrub to near the end of the video.
4.) Rotate the device.

Expected result

Regardless of where the position was in the video, return to that position once the concatenated video is finished setting up in Exoplayer.

Actual result

When the position is early in the video everything works fine, but when near the end odd behavior happens. OnTimelineChanged doesn't get called for each video, only some of them. The video's duration ends up being shorter with the position being all the way at the end.

For example say two videos take up 25 seconds. Upon the bug happening the duration cuts to 16 seconds on the time bar.

Media

Link to my project example

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.