transportFile method

Future<void> transportFile({
  1. bool isImage = false,
})

Implementation

Future<void> transportFile({bool isImage = false}) async {
  if (targetFile != null && _currentCamera == CameraLensDirection.front) {
    var saveFilePath = p.dirname(targetFile!.path);
    var path = p.join(
        saveFilePath,
        DateTime.now().millisecondsSinceEpoch.toString() +
            p.extension(targetFile!.path));
    late FFmpegSession fFmpegSession;
    if (Platform.isAndroid) {
      if (isImage) {
        fFmpegSession = await FFmpegKit.execute(
            '-y -i ${targetFile!.path}  -vf transpose=3 -preset ultrafast  $path ');
      } else {
        fFmpegSession = await FFmpegKit.execute(
            '-y -i ${targetFile!.path}  -vf hflip -preset ultrafast  $path ');
      }
    } else {
      if (isImage) {
        fFmpegSession = await FFmpegKit.execute(
            '-y -i ${targetFile!.path}  -vf  transpose=0 -preset ultrafast  $path ');
      } else {
        fFmpegSession = await FFmpegKit.execute(
            '-y -i ${targetFile!.path}   -preset ultrafast  $path ');
      }
    }

    var code = await fFmpegSession.getReturnCode();
    if (ReturnCode.isSuccess(code)) {
      log('ffmpeg covert success ');
      targetFile = XFile(path);
    } else {
      log('ffmpeg covert fail (${code?.toString()})');
    }
  }
}