Background Video Upload

Hey everyone - does anyone have any recommendations for how to upload video files recorded on the phone to a web service? It seems like we are running into a couple of issues:

  1. Uploads quit when app is backgrounded (at least on iOS)
  2. Sometimes, app crashes when attempting to upload large video file.

Has anyone had any luck handling this? We are attempting to upload videos up to 500MB. Thanks.

1 Like

use FileSystem.uploadAsync and set session type to background: FileSystem - Expo Documentation


@brents you are a lifesaver!!! I’m so happy I could cry! For anyone else on this thread, this call does run in the background and the file continues uploading even when the app is backgrounded.

Thanks so much!

1 Like

I was getting the same issue.
thank you so much.

Hey all, when I’m uploading a video in the background, sometimes the video upload completes, but usually I get this error from using FileSystem in iOS:

Error: Unable to upload the file: 'Error Domain=NSURLErrorDomain Code=-997 "Lost connection to background transfer service" UserInfo={NSErrorFailingURLStringKey={{bucket}}, NSErrorFailingURLKey={{bucket}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <40D1EB30-0F5E-457B-8A19-18610D4A6C3A>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <40D1EB30-0F5E-457B-8A19-18610D4A6C3A>.<1>, NSLocalizedDescription=Lost connection to background transfer service}'

In this example I am trying to upload to an AWS s3 bucket, but I am also experiencing the same error when uploading to my personal server using Multer. Generally, the larger the video is, the more likely that this error will happen, and if the video is more than a minute long and/or a few hundred megabytes, the FileSystem uploader crashes my entire app.

Does anybody have any ideas as to what is causing this issue?

Here is my function call to FileSystem to upload the video if that helps:

FileSystem.uploadAsync(awsUrl, localVideo, {
        successActionStatus: 201,
        sessionType: FileSystem.FileSystemSessionType.BACKGROUND,
        httpMethod: 'POST',
        fieldName: 'file',
        mimeType: 'video/mov',
        uploadType: FileSystem.FileSystemUploadType.MULTIPART,
        parameters: awsParams