Closed pro100svitlo closed 4 years ago
Or another way:
audio/playlist
play({int index = 0})
hi, thanks for the issue, why not opening a new playlist directly ?
If you click on stop it should be better
you keep your audios inside a List, and sort them differenlty when click on play (after your stop) ?
and for me pressing stop make the playlist not usable again,
you have to re-use open to play it again, even for a standard playlist
class MyWidget {
final List<Audio> allAudios = [...];
final AssetsAudioPlayer _player = AssetsAudioPlayer();
void open() {
if(firstTime) {
_player.open(allAudios, startIndex: 0);
} else {
_player.open(allAudios, startIndex: 3);
}
}
}
and for me pressing stop make the playlist not usable again, you have to re-use open to play it again, even for a standard playlist
this is the reason why I didn't use stop
button as its designed.
I am using it as release
.
So (its another topic, but) I can propose also to separate stop
and release
/dispose
.
Yeah, I know there is dispose
method 😄
What I expect from stop
? Stop playing and put position to 0 without releasing the audio. Releasing audio and player itself is the responsibility of dispose
method, IMO.
class MyWidget { final List<Audio> allAudios = [...]; final AssetsAudioPlayer _player = AssetsAudioPlayer(); void open() { if(firstTime) { _player.open(allAudios, startIndex: 0); } else { _player.open(allAudios, startIndex: 3); } } }
Will try this way, thanks :)
Yes I agree with you, what I can do, keep the last opened audio (or playlist), and on stop, it ''stop'' :D, but not release the audio. And on next play, it can reopen the audio,
I will add a startIndex method to change it for this case ;)
I really appreciate your effort :)
I added the stop then play which reopen at startIndex, and you can edit the playlist startindex, it's now mutable
_player.playlist?.startIndex = 1;
can you try 2.0.2+3
?
Describe the feature you'd like I am creating a playlist once per lifecycle and I would like to have the possibility to play the same queue but with the possibility to start from different positions.
For example, user click play the first time (I am opening playlist with the position of this item). Then he clicks stop (notification is hidden). Then he selects another composition and clicks play again (here I would like to change start index for the playlist and reuse it again).