mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 16:29:30 +01:00
chore: Fix video compress
This commit is contained in:
parent
93e22cf468
commit
5e0002fbb8
@ -22,15 +22,16 @@ extension ResizeImage on MatrixFile {
|
|||||||
Future<MatrixVideoFile> resizeVideo() async {
|
Future<MatrixVideoFile> resizeVideo() async {
|
||||||
final tmpDir = await getTemporaryDirectory();
|
final tmpDir = await getTemporaryDirectory();
|
||||||
final tmpFile = File(tmpDir.path + name);
|
final tmpFile = File(tmpDir.path + name);
|
||||||
|
final compressedFile = File(tmpDir.path + 'compressed_' + name);
|
||||||
MediaInfo? mediaInfo;
|
MediaInfo? mediaInfo;
|
||||||
await tmpFile.writeAsBytes(bytes);
|
await tmpFile.writeAsBytes(bytes);
|
||||||
try {
|
try {
|
||||||
mediaInfo = await VideoCompress.compressVideo(tmpFile.path);
|
mediaInfo = await VideoCompress.compressVideo(compressedFile.path);
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
SentryController.captureException(e, s);
|
SentryController.captureException(e, s);
|
||||||
}
|
}
|
||||||
return MatrixVideoFile(
|
return MatrixVideoFile(
|
||||||
bytes: await tmpFile.readAsBytes(),
|
bytes: await compressedFile.readAsBytes(),
|
||||||
name: name,
|
name: name,
|
||||||
mimeType: mimeType,
|
mimeType: mimeType,
|
||||||
width: mediaInfo?.width,
|
width: mediaInfo?.width,
|
||||||
|
Loading…
Reference in New Issue
Block a user