Skip to content

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

Open
@BrLudington

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

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions