google / google/ExoPlayer

Prepare progressive streams in MediaSource.prepare

Open
#4,727 8 comments 2 reactions 1 assignee Claimed by @tonihei View on GitHub
enhancement
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I am using the functionality of `ConcatenatingMediaSource` together with `setShowMultiWindowTimeBar(true)`.
My goal is to play multiple videos on the same window with one long seekbar, one period, and multi-window time bar of all videos in total.
When I concatenate 2 videos it works as expected - calculates the total length and enables seeking over the whole concatenated video, but I have noticed that in case of **more
than 2 videos** it will only concatenate the, but won't play them on the same window with all related support, so once video A ends B starts immediately and so on, which means that concatenating works without `multiWindowSupport` in this case.

To reproduce that quickly in the demo app , I added the following code in `PlayerActivity`

```
MediaSource[] mediaSources = new MediaSource[uris.length];
for (int i = 0; i < uris.length; i++) {
mediaSources[i] = buildMediaSource(uris[i], extensions[i], mainHandler, eventLogger);
}
ConcatenatingMediaSource mediaSource = new ConcatenatingMediaSource(true, mediaSources);
simpleExoPlayerView.controller.setShowMultiWindowTimeBar(true);
```

### media.exolist.json

[]( {
"name": "Cats -> Dogs",
"playlist": [
{
"uri": "https://html5demos.com/assets/dizzy.mp4"
},
{
"uri": "https://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv"
},
{
"uri": "https://html5demos.com/assets/dizzy.mp4"
}
]
},)

Go to menu and choose PlayLists >> Cats ->Dogs.
When using only two videos (_dizzy.mp4_ ,_main-1280x720.mkv_ ) it works as expected, but in case of 3 videos as in my example, `setShowMultiWindowTimeBar(true)` does not work.
In this example the combination above fails, but changing the third video to a different source passes.
Why is this happening? Am I missing any restrictions on the total length of the videos?

This happens while concatenating 5+ different length private unique videos in my app, while any random pairs of 2,3,4 videos work perfect until comes the last video and disables `MultiWindowTimeBar`. Added example above with videos from demo app for easy testing. All videos are not corrupted mp4 since I'm able to use each one of them in a pair with other.
I am wondering what causes that?

Using version 2.8.4
Running on Android 6,7,8 , Galaxy S7,S8

Did the next workaround in demo app to test, all 3 videos came out as expected with correct time bar and a singular window.
### PlaybackControlView
```
[725] // multiWindowTimeBar = showMultiWindowTimeBar && canShowMultiWindowTimeBar(player.getCurrentTimeline(), window);
multiWindowTimeBar = true;

[751] if (window.durationUs == C.TIME_UNSET) {
// Assertions.checkState(!multiWindowTimeBar);
break;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.