public async Task<IUploadRequest> StartUploadFileAsync(IBinaryContent fileContent, int chunkSize = DEFAULT_UPLOAD_CHUNK_SIZE, long? replaceVideoId = null) { if (!fileContent.Data.CanRead) { throw new ArgumentException("fileContent should be readable"); } if (fileContent.Data.CanSeek && fileContent.Data.Position > 0) { fileContent.Data.Position = 0; } UploadTicket ticket = replaceVideoId.HasValue ? await GetReplaceVideoUploadTicketAsync(replaceVideoId.Value) : await GetUploadTicketAsync(); var uploadRequest = new UploadRequest { Ticket = ticket, File = fileContent, ChunkSize = chunkSize }; VerifyUploadResponse uploadStatus = await ContinueUploadFileAsync(uploadRequest); return uploadRequest; }
public async Task<IUploadRequest> StartUploadFileAsync(IBinaryContent fileContent, int chunkSize = DEFAULT_UPLOAD_CHUNK_SIZE) { if (!fileContent.Data.CanRead) { throw new ArgumentException("fileContent should be readable"); } if (fileContent.Data.CanSeek && fileContent.Data.Position > 0) { fileContent.Data.Position = 0; } UploadTicket ticket = await GetUploadTicketAsync(); var uploadRequest = new UploadRequest { Ticket = ticket, File = fileContent, ChunkSize = chunkSize }; VerifyUploadResponse uploadStatus = await ContinueUploadFileAsync(uploadRequest); uploadRequest.BytesWritten = uploadStatus.BytesWritten; return uploadRequest; }