rurico / flutter_video_compress

Generate a new file by compressed video, and provide metadata. Get video thumbnail from a video path, supports JPEG/GIF. To reduce app size not using FFmpeg in IOS.
MIT License
185 stars 72 forks source link

Null check operator used on a null value #112

Open hmbadhon opened 1 year ago

hmbadhon commented 1 year ago

Description

.mp4 file compression is pretty good but when i pick .mov file to compress it's couldn't able to compress and file path throwing null exception.

Platform

IOS|Android|Both|Other

Code Example (if has)


for (var element in dto.media) {
      var file = await PhotoGallery.getFile(mediumId: element.id);
      Uint8List? data;
      if (element.mediumType == MediumType.image) {
        data = await AppUtils.compressToUint8List(
            file.path, element.height, element.width, 50);
        files.add(MultipartFile.fromBytes(data!,
            filename: getFileName(element.filename!)));
      } else {
        log("File name ===========> ${file.path}");
        log("Compress Start ===========> ${DateTime.now()}");
        try {
          showProgressDialogStatus(0);
          final response = await vc.VideoCompress.compressVideo(
            file.path,
            quality: vc.VideoQuality.MediumQuality,
            // deleteOrigin: false, // It's false by default
          );
          log("File path ===========> ${response!.path}");
          log("Compress end ===========> ${DateTime.now()}");

          var multipart = await MultipartFile.fromFile(response.path!,
              filename: getFileName(response.path!));
          files.add(multipart);
        } catch (e) {
          log("compress error ===========> $e");
        }
      }
    }