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

Determine whether seeking or repeating #3252

Closed
AOrobator opened this issue Sep 9, 2017 · 6 comments
Closed

Determine whether seeking or repeating #3252

AOrobator opened this issue Sep 9, 2017 · 6 comments
Assignees

Comments

@AOrobator
Copy link
Contributor

AOrobator commented Sep 9, 2017

Does Exoplayer have any plans to distinguish between seeking to the beginning of a period and repeating once? Using the repeat modes and a DynamicConcatenatingMediaSource, if I check that player.getCurrentPosition() == 0 in onPositionDiscontinuity(), I'm not able to tell whether the song has just repeated or the user has seeked to the beginning of the song. Some sort of callback in Player.EventListener would be great.

@AOrobator
Copy link
Contributor Author

AOrobator commented Sep 9, 2017

@tonihei
Copy link
Collaborator

tonihei commented Sep 11, 2017

We thought about different ways of providing a clear way to notify the listener of what caused a position discontinuity. Our preferred method is to add a parameter to the onPositionContinuity(@PositionContinuityReason int reason) callback. It would provide one of three possible reasons: 1. automatic transition to next period (might be repeating the current one), 2. seeking within the current to another period, 3. other internal reasons causing a discontinuity.
Would that solve your issue? I think it gives you that extra bit of information (in addition to the period/window index and current playback position) to allow you to distinguish between all different cases.

@AOrobator
Copy link
Contributor Author

AOrobator commented Sep 11, 2017

Having a parameter in onPositionDiscontinuity() would be a great solution. I think we should separate the first reason into 2 different int reasons. One if it's repeating, another if it isn't.

@tonihei
Copy link
Collaborator

tonihei commented Sep 11, 2017

I think you can easily check if it is repeating the same item by comparing the period or window index to the previous one. Alternatively, you can also check the current repeat mode (player.getRepeatMode()) to determine whether playback is in a repeat loop or not.

It wouldn't make much sense to add it here given how easy it is to get this information from the player. Besides, it would add unnecessary complications to the interface as there might be more parameters influencing the automatically selected next period (e.g. the shuffle mode, changes to a dynamic playlist, etc.).

That said - we will add the described parameter to the onPositionDiscontinuity callback. Should be available in one of our upcoming releases (or the dev-branch).

ojw28 pushed a commit that referenced this issue Sep 15, 2017
This allows listeners to easily determine the source of the discontinuity.
Reasons can be period transitions, seeks, and internal reasons.

Listeners still using the deprecated ExoPlayer.EventListener interface were
updated to Player.EventListener.

GitHub: #3252

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168549612
@ojw28 ojw28 closed this as completed Sep 21, 2017
@natez0r
Copy link
Contributor

natez0r commented Sep 22, 2017

is this planned for 2.5.4?

@ojw28
Copy link
Contributor

ojw28 commented Sep 22, 2017

It will land in 2.6.0. We don't have an ETA.

@google google locked and limited conversation to collaborators Jan 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants