compressVideo method

dynamic compressVideo(
  1. String videoPath
)

Compresses the video file at the given path and returns the compressed file.

Implementation

compressVideo(String videoPath) async {
  // Get the original file size
  final originalFileSize = File(videoPath).lengthSync();
  debugPrint('Original video size: $originalFileSize bytes... $videoPath');

  final compressedVideo = await VideoCompress.compressVideo(
    videoPath,
    quality: VideoQuality.DefaultQuality,
  );

  // Get the compressed file size
  final compressedFileSize = compressedVideo!.file?.lengthSync();
  debugPrint(
      'Compressed video size: $compressedFileSize bytes... $videoPath');

  return compressedVideo.file;
}