Skip to content

Commit 5854067

Browse files
committed
feat(progressive_uploader): Allow custom video name
1 parent 58556ac commit 5854067

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/progressive-video-uploader.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { PromiseQueue } from "./promise-queue";
33

44
export interface ProgressiveUploadCommonOptions {
55
preventEmptyParts?: boolean;
6+
videoName?: string
67
}
78

89
export interface ProgressiveUploaderOptionsWithUploadToken extends ProgressiveUploadCommonOptions, CommonOptions, WithUploadToken { }
@@ -25,10 +26,12 @@ export class ProgressiveUploader extends AbstractUploader<ProgressiveProgressEve
2526
private currentPartBlobsSize = 0;
2627
private queue = new PromiseQueue();
2728
private preventEmptyParts: boolean;
29+
private fileName: string;
2830

2931
constructor(options: ProgressiveUploaderOptionsWithAccessToken | ProgressiveUploaderOptionsWithUploadToken | ProgressiveUploaderOptionsWithApiKey) {
3032
super(options);
3133
this.preventEmptyParts = options.preventEmptyParts || false;
34+
this.fileName = options.videoName || 'file';
3235
}
3336

3437
public uploadPart(file: Blob): Promise<void> {
@@ -71,7 +74,7 @@ export class ProgressiveUploader extends AbstractUploader<ProgressiveProgressEve
7174
private async upload(file: Blob, isLast: boolean = false): Promise<VideoUploadResponse> {
7275
const fileSize = file.size;
7376
return this.xhrWithRetrier({
74-
body: this.createFormData(file, "file"),
77+
body: this.createFormData(file, this.fileName),
7578
parts: {
7679
currentPart: this.currentPartNum,
7780
totalParts: isLast ? this.currentPartNum : '*'

0 commit comments

Comments
 (0)