stop method

  1. @override
void stop()
override

Implementation

@override
void stop() {
  forwardHandler?.stop();
  forwardHandler = null;

  _clearListeners();

  final old = _audioElement;
  if (old != null) {
    isPlaying = false;
    old.pause();
    old.currentTime = 0;
    // Fully detach the old element so the browser releases its media
    // resource. Without this, a subsequent open() can leave the previous
    // element still playing, producing overlapping audio.
    old.src = '';
    old.load();
    _audioElement = null;
    channel.invokeMethod(WebPlayer.methodPosition, 0);
  }
}