'How to check Audio is finished or not in just audio library?

How to check audio is completed or not?

On finished change icon from pause to play.



Solution 1:[1]

use audioplayers: https://pub.dev/packages/audioplayers

 player.onPlayerCompletion.listen((event) {
    onComplete();
    setState(() {
      position = duration;
    });
  });

Solution 2:[2]

there is a way to listen to state changes you can use that

      audioPlayer.playerStateStream.listen((state) {
        if (state.processingState == ProcessingState.completed) {
          onComplete();
        }
      });

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Netharu Methmitha