Replies: 1 comment 1 reply
-
You only play the first song, as the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to use the Audioplayer to play a list of MP3-Files.
Hence I have to iterate over the list.
My idea is to check the PlayerState and if the player is not playing I increase the index and play the next song.
However this does not work.
I would appreciate a hint.
Kind regards
The code looks like
...
Future getPlayerState() async {
setState(() => state = player.state);
}
...
PlayerState state;
PlayerState PLAYING = PlayerState.playing;
...
IconButton(
icon: Icons.play_arrow,
onPressed: () {
index = 0;
while (index < _playlist.length) {
if (getPlayerState() != PLAYING ) {
player.play(_playlist[index]);
index++;
}
}
);
...
Beta Was this translation helpful? Give feedback.
All reactions