Skip to content
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

BasePlayer::setMediaItems resetPosition is not used #8024

Closed
loki666 opened this issue Oct 1, 2020 · 4 comments
Closed

BasePlayer::setMediaItems resetPosition is not used #8024

loki666 opened this issue Oct 1, 2020 · 4 comments
Assignees
Labels

Comments

@loki666
Copy link
Contributor

loki666 commented Oct 1, 2020

public void setMediaItems(List<MediaItem> mediaItems, boolean resetPosition) {

@krocard
Copy link
Contributor

krocard commented Oct 1, 2020

@marcbaechinger is this on purpose? simpleExoPlayer overrides the method but only calls ExoPlayerImpl which use the BasePlayer implementation ignoring the parameter. So resetPosition seems to always be ignored for both setMediaItem methods with a resetPosition parameter when calling on SimpleExoPlayer or ExoPlayerImpl.

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Oct 1, 2020

Yes, that doesn't look right. Thanks for reporting. I look into this.

Edit: As a workaround you can do

setMediaItems(items, 0, C.TIME_UNSET);

instead of

setMediaItems(items, /* resetPosition= */ true);

@loki666
Copy link
Contributor Author

loki666 commented Oct 1, 2020

Yes, that doesn't look right. Thanks for reporting. I look into this.

Edit: As a workaround you can do

setMediaItems(items, 0, C.TIME_UNSET);

instead of

setMediaItems(items, /* resetPosition= */ true);

thanks, I'm calling seekTo after setMediaItems as a workaround now

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Oct 1, 2020

Cool! Fix is on it's way, btw.

Just to be a bit more precise to my comment above. A general solution would need something like this:

Timeline timeline = player.getCurrentTimeline();
int windowIndex = timeline.isEmpty()
    ? 0 
    : timeline.getFirstWindowIndex(player.getShuffleModeEnabled());
player.setMediaItems(items, windowIndex, C.TIME_UNSET);

kim-vde pushed a commit that referenced this issue Oct 13, 2020
Issue: #8024
PiperOrigin-RevId: 335846035
ojw28 pushed a commit that referenced this issue Oct 21, 2020
Issue: #8024
PiperOrigin-RevId: 335846035
@google google locked and limited conversation to collaborators Dec 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants