destroy method

void destroy()

销毁播放控制器

Destroy the player controller

Implementation

void destroy() {
  if (_isDestroyed) return;
  _isDestroyed = true;

  // The next line disables the wakelock again.
  if (_widgetData?.allowedScreenSleep == false) {
    WakelockPlus.disable();
  }

  // 取消应用生命周期监听
  _lifecycleListener.dispose();

  // 停止并销毁策略系统
  strategyManager.dispose();

  // 确保顺序:先停止播放器和下载器,再释放 notifier
  Future.microtask(() {
    _destroyPlayer();
    _destroyDownloader();
    _disposeValueNotifiers();
  });
}