'Expo upload background video to s3
I'm working on an Expo project where users will take videos and upload them for organization and viewing them. I've been trying to upload videos taken using the expo-camera API to a storage bucket in AWS. I've been using the expo-file-system's upload in background functionality to upload videos, but I've come across an error that I don't have any idea how to handle. It generally happens the bigger the video is, and if it is over a minute, the app is likely to crash when I start to upload. Here is the FileSystem function call I make to upload the video:
FileSystem.uploadAsync(awsurl, localVideo, {
successActionStatus: 201,
sessionType: FileSystem.FileSystemSessionType.BACKGROUND,
httpMethod: 'POST',
fieldName: 'file',
mimeType: 'video/mov',
uploadType: FileSystem.FileSystemUploadType.MULTIPART,
parameters: awsparams
})
and here is the error that is occurring
Error: Unable to upload the file: 'Error Domain=NSURLErrorDomain Code=-997 "Lost connection to background transfer service" UserInfo={NSErrorFailingURLStringKey=https://s3.us-west-2.amazonaws.com/{{bucket}}, NSErrorFailingURLKey=https://s3.us-west-2.amazonaws.com/{{bucket}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"BackgroundUploadTask <40D1EB30-0F5E-457B-8A19-18610D4A6C3A>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <40D1EB30-0F5E-457B-8A19-18610D4A6C3A>.<1>, NSLocalizedDescription=Lost connection to background transfer service}'
I've tried multiple combinations of fieldName, mimeType and uploadType, but have had no success in getting large uploads to work. Any ideas how to fix this or effective ways to debug would be great! If anyone knows of a way in Expo to break videos into smaller chunks for uploads that would also be very helpful
Expo version is 43
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
