diff --git a/mobile/lib/ui/viewer/file/video_widget_native.dart b/mobile/lib/ui/viewer/file/video_widget_native.dart index 68653265c7..b84cdc0e3c 100644 --- a/mobile/lib/ui/viewer/file/video_widget_native.dart +++ b/mobile/lib/ui/viewer/file/video_widget_native.dart @@ -112,6 +112,7 @@ class _VideoWidgetNativeState extends State _streamSwitchedSubscription = Bus.instance.on().listen((event) { if (event.type != PlayerType.nativeVideoPlayer) return; + _filePath = null; if (event.selectedPreview) { loadPreview(update: true); } else { @@ -133,6 +134,11 @@ class _VideoWidgetNativeState extends State } Future setVideoSource() async { + if (_filePath == null) { + _logger.info('Stop video player, file path is null'); + await _controller?.stop(); + return; + } final videoSource = VideoSource( path: _filePath!, type: VideoSourceType.file,