From 7c88ce89b1f64ad728777cd573756759cbc900b5 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 27 Dec 2021 18:33:29 +0100 Subject: [PATCH] chore: FIx video compress --- lib/utils/resize_image.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/utils/resize_image.dart b/lib/utils/resize_image.dart index da130ad3..aed19b42 100644 --- a/lib/utils/resize_image.dart +++ b/lib/utils/resize_image.dart @@ -22,16 +22,15 @@ extension ResizeImage on MatrixFile { Future resizeVideo() async { final tmpDir = await getTemporaryDirectory(); final tmpFile = File(tmpDir.path + '/' + name); - final compressedFile = File(tmpDir.path + '/compressed_' + name); MediaInfo? mediaInfo; await tmpFile.writeAsBytes(bytes); try { - mediaInfo = await VideoCompress.compressVideo(compressedFile.path); + mediaInfo = await VideoCompress.compressVideo(tmpFile.path); } catch (e, s) { SentryController.captureException(e, s); } return MatrixVideoFile( - bytes: await compressedFile.readAsBytes(), + bytes: (await mediaInfo?.file?.readAsBytes()) ?? bytes, name: name, mimeType: mimeType, width: mediaInfo?.width,