OnTimelineChanged skips mediaItems and messes up video duration when using a concatenated mediaSource
@tianyif is already working on this.
Since Dec 23, 2024.
- 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
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.