stopAndInit method

Future<void> stopAndInit()

Implementation

Future<void> stopAndInit() async {
  try {
    _checkDisposed();
    _playing = false;
    _mediaUrl = MediaUrl(url: '');
    _isInitialized = false;
    _showTip = false;
    if (!_initializedController.isClosed) {
      _initializedController.add(false);
    }
    if (!_showTipController.isClosed) {
      _showTipController.add(false);
    }
    _tipTime = null;
    _tipWidget = null;
    _castWidget = null;
    _castDevicesType = DevicesType.all;
    return await _player.stop();
  } catch (e) {
    if (kDebugMode) {
      print("play error: $e");
    }
    return Future.value();
  }
}