destroy method

void destroy()

释放下载器资源

Implementation

void destroy() {
  _subscription?.cancel();
  _subscription = null;

  int selectVideoIndex = 0;
  if (null != _currentTrackInfoNotifier.value) {
    selectVideoIndex = _currentTrackInfoNotifier.value!.trackIndex ?? 0;
  }

  final source = _widgetDataGetter()?.videoSource;
  if (source is VidStsVideoSource) {
    _downloader.release(source.vid, selectVideoIndex);
  } else if (source is VidAuthVideoSource) {
    _downloader.release(source.vid, selectVideoIndex);
  }

  stateNotifier.dispose();
}