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

The shuffle button only plays from the first one at playlist #391

Closed
yuruxuan opened this issue Jan 28, 2023 · 3 comments
Closed

The shuffle button only plays from the first one at playlist #391

yuruxuan opened this issue Jan 28, 2023 · 3 comments

Comments

@yuruxuan
Copy link
Contributor

During my use, I found that every time I click the shuffle button, the first music is always the first song in the playlist every time. Starting from the second song, random music will play.

I checked the code and found that the shuffle function directly calls the just_audio library. At the same time, I found that the shuffle() method can pass an initial position parameter. See if this information is helpful to solve this problem?

I haven't read the entire project code completely, and direct modification may introduce new bugs.

@override
  Future<void> setShuffleMode(AudioServiceShuffleMode shuffleMode) async {
    try {
      switch (shuffleMode) {
        case AudioServiceShuffleMode.all:
          await _player.shuffle(); ///////////////////// Maybe need initialIndex params
          await _player.setShuffleModeEnabled(true);
          shuffleNextQueue = true;
          break;
        case AudioServiceShuffleMode.none:
          await _player.setShuffleModeEnabled(false);
          shuffleNextQueue = false;
          break;
        default:
          return Future.error(
              "Unsupported AudioServiceRepeatMode! Recieved ${shuffleMode.toString()}, requires all or none.");
      }
    } catch (e) {
@Chaphasilor
Copy link
Collaborator

there's already an issue for this: #61

it seems to be a problem with just_audio

@jmshrv
Copy link
Owner

jmshrv commented Jan 29, 2023

Duplicate of #61

@jmshrv jmshrv marked this as a duplicate of #61 Jan 29, 2023
@jmshrv jmshrv closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2023
@jmshrv
Copy link
Owner

jmshrv commented Jan 29, 2023

I'll try messing about with initialIndex :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants