Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video uploads larger than ~100MB fail on iOS #239

Merged
merged 4 commits into from
May 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ios/VydiaRNFileUploader.m
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ - (void)copyAssetToFile: (NSString *)assetUrl completionHandler: (void(^)(NSStri
[request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", uuidStr] forHTTPHeaderField:@"Content-Type"];

NSData *httpBody = [self createBodyWithBoundary:uuidStr path:fileURI parameters: parameters fieldName:fieldName];
[request setHTTPBody: httpBody];
[request setHTTPBodyStream: [NSInputStream inputStreamWithData:httpBody]];
[request setValue:[NSString stringWithFormat:@"%zd", httpBody.length] forHTTPHeaderField:@"Content-Length"];

uploadTask = [[self urlSession: appGroup] uploadTaskWithStreamedRequest:request];
} else {
Expand Down Expand Up @@ -354,4 +355,15 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data
}
}

- (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task
needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler {

NSInputStream *inputStream = task.originalRequest.HTTPBodyStream;

if (completionHandler) {
completionHandler(inputStream);
}
}

@end