This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
Deprecate playAt
for seeking initial position
#211
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Whilst working on the adverts loader I noticed that when we want to perform a seek to an initial position we do:
loadVideo
->playAt
/seekTo
This has very little chance of notifying us in the correct order.
ExoPlayer
is essentially message based so you are going to be rendering the first frame of content before performing a seek in this flow. After looking at theExoPlayer
code in a little more detail I can see that we need to perform a seek before we prepare the underlying player. This way the timeline and the position information is updated prior to the first frame being rendered.Solution
Add an
initialPositionInMillis
to theOptions
. When thisOption
is available we perform a seek and tell the player not to reset the positional information for the player. This means when the first frame rendered it will be from that position in the Timeline.Test(s) added
Just updating the facade tests to ensure that when this position information is present we will perform a seek before playing.
Screenshots
For those that are interested I have some rather long logs. These are informational, so these are the listeners that exo-player calls when it does anything
Before
After
Paired with
Nobody.