Exoplayer: Transition delay in exoplayer playlist

Created on 14 Apr 2020  路  6Comments  路  Source: google/ExoPlayer

Working with playlist on the ExoPlayer, I managed the setting of the playlist by following the documentation.

val firstSource = ProgressiveMediaSource.Factory(...).createMediaSource(firstVideoUri);
val secondSource = ProgressiveMediaSource.Factory(...).createMediaSource(secondVideoUri);

val playlist = ConcatenatingMediaSource(firstSource, secondSource);

player.prepare(playlist)

But I noticed that the transition between video is instantaneous. However, I would like to add a waiting stage between each video, exactly like youtube does (let's say 5 sec).

Is it already handled by the Exoplayer itself or not? If not what is a clean way to solve the problem ?

Originally posted on StackOverflow

question

All 6 comments

A simple thing which comes to my mind is using a SilenceMediaSource which you can put in between the actual tracks. You can then listen to onPositionDiscontinuity() to trigger actions like putting a view on top when the silence media source starts and remove the view again when the silence ends.

Another option that is only available on the dev branch so far is to tell the player to pause at the end of each media item with player.setPauseAtEndOfMediaItems(true). And as soon as the player is paused (listen to onPlayWhenReadyChanged with reason PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM), you can start your waiting UI animation (or whatever you are planning to do with this stage), and after 5 seconds you can call player.play() again to continue with the next item.

@tonihei @marcbaechinger Do you know when this setPauseAtEndOfMediaItems(true) feature will be available?

We can't give exact release dates yet, but probably within the next month or two depending on how fast we can cut a release branch with a sensible stable state.

Is there a specific reason why the user can't set a tag for a SilenceMediaSource ? If not I'm willing to do a pull request for something like:

SilenceMediaSource.Factory().setDuration(...).setTag(...).build()

Because in my use case, I'm relying on the tag to know the id of my current playing video.

Your pull request has been merged into dev-v2. Many thanks for your contribution. I'm closing this issue for now. Please reopen if you think we can help some further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mkaflowski picture mkaflowski  路  3Comments

0x410c picture 0x410c  路  3Comments

Ufosek picture Ufosek  路  3Comments

orcunkobal picture orcunkobal  路  3Comments

R00We picture R00We  路  3Comments