AWS s3 upload + api too long

I am currently using amazon s3 to store all objects such as images and videos. I am using the iOS AWS SDK to load objects.

Stream my application

  • The user takes a picture or records a video.
  • The user adds additional form information, something like Instagram Headline (using Alamofire)
  • user clicks continue and then AWS will start uploading images and videos to S3 using the iOS AWS SDK
  • After the object has been successfully uploaded to S3, S3 will respond with a link
  • Finally, using Alamofire to send information, including a link from S3 as POST API parameters

The problem I am facing is that it takes quite a lot to complete the AWS + loading API call. This is a really bad user experience. Most images are less than 5 MB.

My decision

  • Resizing an image, but what about the video?

  • After the user clicks the Continue button, instead of loading the AWS + API call, why not do it as a background on another screen, so users don’t have to wait for the download indicator

What approach is suitable to solve this problem? Thanks

+4
source share
4 answers

" ?"

- AWS .

S3 , - .

  • , - SSD EBS.
  • EC2 ​​.
  • AWS .

, , , , S3 , .

, URL- , S3.

β†’ β†’ .

β†’ β†’ S3 β†’ .

+1

, , AWS, .

Amazon S3 , , Cloudfront - .

, S3.

0

, S3 Transfer Acceleration. , .

, 5 . , , , . , .

0

, , , . .

:

class FileUploader {
    uploadingFiles: [String]

    func uploadFile(path: String) -> Task {
        uploadingFiles.add(path)

        runInBackground({
            // make all requests here

            runInMainThread({
                uploadingFiles.remove(path) 

                if error {
                    NSNotificationsCenter.default().post('UploadingError', error)
                } else {
                    NSNotificationsCenter.default().post('FileUploaded', path) 
                }
            })
        })
    }
}

, , AppDelegate. , , ( NSNotificationCenter ViewWillAppear ViewDidDisappear). AppDelegate .

( ) .

s3 - , , ( s3, , ).

Resizing

You can simply show a warning that the file is too large (if> 10 MB for a photo or 100 MB for a video). Later, if you have enough time, you can always try resizing images / videos before uploading - not a bad idea.

0
source

Source: https://habr.com/ru/post/1668082/


All Articles