From 4f3fe73daa0e5235d97bac011fa808860bd3211a Mon Sep 17 00:00:00 2001 From: ashilkn Date: Fri, 2 Aug 2024 13:33:32 +0530 Subject: [PATCH] [mob][photos] Fix getVideoPropsAsync failing in native video player because a normal file and not the origin file was being passed to it in case of locally available vidoes --- .../lib/ui/viewer/file/video_widget_native.dart | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mobile/lib/ui/viewer/file/video_widget_native.dart b/mobile/lib/ui/viewer/file/video_widget_native.dart index ba80325cf2..e4df35e140 100644 --- a/mobile/lib/ui/viewer/file/video_widget_native.dart +++ b/mobile/lib/ui/viewer/file/video_widget_native.dart @@ -81,11 +81,9 @@ class _VideoWidgetNativeState extends State } } else { // ignore: unawaited_futures - asset.getMediaUrl().then((url) { - _setFilePathForNativePlayer( - url ?? - 'https://user-images.githubusercontent.com/28951144/229373695-22f88f13-d18f-4288-9bf1-c3e078d83722.mp4', - ); + getFile(widget.file, isOrigin: true).then((file) { + _setFilePathForNativePlayer(file!.path); + file.delete(); }); } }); @@ -261,7 +259,12 @@ class _VideoWidgetNativeState extends State final videoProps = await getVideoPropsAsync(File(_filePath!)); if (videoProps != null) { if (videoProps.width != null && videoProps.height != null) { - aspectRatio = videoProps.width! / videoProps.height!; + if (videoProps.width != null && videoProps.height != 0) { + aspectRatio = videoProps.width! / videoProps.height!; + } else { + _logger.info("Video props height or width is 0"); + aspectRatio = 1; + } } else { _logger.info("Video props width and height are null"); aspectRatio = 1;