Automatically play next music
This commit is contained in:
parent
fb573cfc7c
commit
0cdb9a6c27
@ -50,8 +50,11 @@ class _MusicPlayerState extends State<MusicPlayer> {
|
|||||||
_playNext();
|
_playNext();
|
||||||
});
|
});
|
||||||
|
|
||||||
audioPlayer.onPlayerStateChanged
|
audioPlayer.onPlayerStateChanged.listen((s) => setState(() {
|
||||||
.listen((s) => setState(() => {_playerState = s}));
|
_playerState = s;
|
||||||
|
|
||||||
|
if (_playerState == PlayerState.COMPLETED) _playNext();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _play() async {
|
Future<void> _play() async {
|
||||||
|
Loading…
Reference in New Issue
Block a user