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

How to play next media source after enable mode shuffle programmactically #4863

Closed
hafiz013 opened this issue Sep 25, 2018 · 5 comments
Closed
Assignees

Comments

@hafiz013
Copy link

hai there developer, how to play next media source (shuffle) after enable mode shuffle in programmatically in stead of depend on next btn from ui controller?

@tonihei
Copy link
Collaborator

tonihei commented Sep 25, 2018

You can check for the next and previous window index using player.getNextWindowIndex() and player.getPreviousWindowIndex(). And then seek to this window using one of the player.seekTo methods.

To simplify such a use case, I'll mark that as an enhancement to add two methods player.next() and player.previous().

@hafiz013
Copy link
Author

the problem is like this, first what i did was player.seekTo(player.getNextWindowsIndex(), C.UNSET) yes it goes to random position of music if enable mode shuffle before call 'player.seekTo(player.getNextWindowsIndex(), C.UNSET) ' however, again when i click again that shuffle button make it crash because no more media source next windows. Note that I have shuffle button and for your information .next() and .previous() are private method not public which can't access this method.

@tonihei
Copy link
Collaborator

tonihei commented Sep 26, 2018

You need to check if getNextWindowIndex() is not C.TIME_UNSET first, before calling seekTo. We will add two methods to the player interface to skip to the next and previous item to make that easier.

ojw28 pushed a commit that referenced this issue Sep 26, 2018
This simplifies code skipping items in a playlist programatically.

Issue:#4863

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214580742
@hafiz013
Copy link
Author

awesome. please do so because easy to use. may I know when latest version will come out.

@tonihei
Copy link
Collaborator

tonihei commented Oct 2, 2018

The commit above added the requested methods.

@tonihei tonihei closed this as completed Oct 2, 2018
ojw28 pushed a commit that referenced this issue Nov 1, 2018
This simplifies code skipping items in a playlist programatically.

Issue:#4863

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214580742
@google google locked and limited conversation to collaborators Jan 31, 2019
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

2 participants