amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

Aws Storage upload issue with video

Open iosephmagno opened this issue 1 year ago • 33 comments

Description

Uploading a mp4 video with Amplify results in a corrupted remote video. Video uploads successfully but any video player says that it has no mime and plays it with wrong aspect ratio. We also noticed that upload is pretty slow.

Any help to fix this is much appreciated.

      final UploadFileResult result = await Amplify.Storage.uploadFile(
        local: file,
        key: key,
        onProgress: (progress) {
          debugPrint(
            '$_debugPrefix $key upload fraction completed: ${progress.getFractionCompleted()}',
          );
          if (eventOnProgress != null) {
            eventOnProgress(progress.getFractionCompleted());
          }
        },
        options: UploadFileOptions(
           contentType: 'video/mp4',
         //  accessLevel: StorageAccessLevel.protected,
        ),
      );

Categories

  • [ ] Analytics
  • [ ] API (REST)
  • [ ] API (GraphQL)
  • [ ] Auth
  • [ ] Authenticator
  • [ ] DataStore
  • [X] Storage

Steps to Reproduce

Upload a video with below code and play it. Video upload will be slow and video will play with wrong aspect ratio. Players report that video with without mime.

      final UploadFileResult result = await Amplify.Storage.uploadFile(
        local: file,
        key: key,
        onProgress: (progress) {
          debugPrint(
            '$_debugPrefix $key upload fraction completed: ${progress.getFractionCompleted()}',
          );
          if (eventOnProgress != null) {
            eventOnProgress(progress.getFractionCompleted());
          }
        },
        options: UploadFileOptions(
           contentType: 'video/mp4',
         //  accessLevel: StorageAccessLevel.protected,
        ),
      );

Screenshots

Original video on client, aspect ratio is 16 / 9, resolution 1920 x 1080 original video on client

Corrupted video played from AWS S3 with wrong aspect ratio and size. corrupted video on aws

Platforms

  • [X] iOS
  • [X] Android
  • [ ] Web
  • [ ] macOS
  • [ ] Windows
  • [ ] Linux

Flutter Version

3.3.10

Amplify Flutter Version

0.6.12

Deployment Method

Amplify CLI

Schema

No response

iosephmagno avatar May 12 '23 15:05 iosephmagno