-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow playlist items to specify a start position #6373
Comments
@tonihei Please could you take a look at this? |
We talked about this feature request recently and decided that we probably need a way to specify a start position for a playlist item that is not the first to be played [internal ref: b/138782031] The approach you mention above of writing a Our suggested new implementation will distinguish between a "start position" and "default position":
|
@tonihei |
This is still an open feature request and not implemented yet. The only way to achieve something similar for now is the workaround with the custom wrapping |
@tonihei Hi, is the current status on this the same as in september '21, regarding your suggested new implementation from '19? :) |
[REQUIRED] Use case description
The use case for
initialSeekTime
is for creating / restoring a playlist or queue in which more than one item has an initial seek.The initial seek is the time that the item was previously paused at. The reason for more than one is that the queue is re-arrangeable and thus an item with an initial seek from position 0 could be moved to position 1 and the item in position 0 is played but also paused. Thus when recreating the playlist, two mediaSource items need an initial seek time.
Proposed solution
I have hacked up a solution where I pass in an initial seek time by setting a new
defaultStartPositionUs
in theProgressiveMediaSource
. This achieves the desired result but I'm not certain that is necessarily correct or what things this may break (outside of working as expected in the playlist example in the demo app).Here is a video. You can see the first item in the playlist plays from the 20 second mark and the next item starts from the 16 seconds mark.
Perhaps the right solution may be to create a class similar to
ClippingMediaSource
that wraps anotherMediaSource
. This wrapping media source could then set thewindowDefaultStartPositionUs
in theTimeline
.Alternatives considered
seekTo
beforeprepare
but this only works for the first item in the playlist.onPositionDiscontinuity
callback. This works for both the first and subsequent items in the playlist. However due to theonPositionDiscontinuity
being a callback, the subsequent items in the playlist always play for some milliseconds before the seek is initiated (inonPositionDiscontinuity
) and thus there is an audible play-buffering-play.Thanks for taking a look at this feature request. I would appreciate any feedback in regards to the proposed solution and if you think that creating a wrapping
MediaSource
to enable the initial seek would fit with the overall architecture of Exoplayer / MediaSources.The text was updated successfully, but these errors were encountered: