release method

void release()

Implementation

void release() {
  stop();
  // Release `AudioElement` correctly (#966)
  player?.src = '';
  player?.remove();
  player = null;
  _stereoPanner = null;

  _playerLoadedDataSubscription?.cancel();
  _playerLoadedDataSubscription = null;
  _playerEndedSubscription?.cancel();
  _playerEndedSubscription = null;
  _playerSeekedSubscription?.cancel();
  _playerSeekedSubscription = null;
  _playerPlaySubscription?.cancel();
  _playerPlaySubscription = null;
  _playerErrorSubscription?.cancel();
  _playerErrorSubscription = null;
}