fix: Reset audioplayer when played until the end

This commit is contained in:
Krille 2023-07-21 07:46:00 +02:00
parent 54b152884a
commit bc73a5da95
No known key found for this signature in database

View file

@ -119,6 +119,10 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
AudioPlayerWidget.wavesCount)
.round();
});
if (state.inMilliseconds.toDouble() == maxPosition) {
audioPlayer.stop();
audioPlayer.seek(null);
}
});
onDurationChanged ??= audioPlayer.durationStream.listen((max) {
if (max == null || max == Duration.zero) return;