stop method

  1. @override
Future<void> stop()
override

Stop the currently playing audio

Implementation

@override
Future<void> stop() async {
  _positionTimer?.cancel();
  _audioElement?.pause();
  if (_audioElement != null) {
    _audioElement!.currentTime = 0.0;
    // Unregister this instance
    _instances.remove(_audioElement);
  }
  _currentPosition = 0.0;
  _isPlaying = false;
  _isPaused = false;
}