Skip to content

Commit 4945067

Browse files
committed
update(video uploader): Post review
1 parent 4367d91 commit 4945067

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/video-uploader.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,10 @@ export class VideoUploader extends AbstractUploader<UploadProgressEvent> {
4949

5050

5151
public async upload(): Promise<VideoUploadResponse> {
52-
if (this.maxVideoDuration !== null && !document) {
52+
if (this.maxVideoDuration !== undefined && !document) {
5353
throw Error('document is undefined. Impossible to use the maxVideoDuration option. Remove it and try again.')
5454
}
55-
let tooLong: boolean = false;
56-
if (this.maxVideoDuration !== null) {
57-
tooLong = await this.checkVideoDuration();
58-
}
59-
if (tooLong) {
55+
if (this.maxVideoDuration !== undefined && await this.isVideoTooLong()) {
6056
throw Error(`The video submitted is too long.`);
6157
}
6258
let res: VideoUploadResponse;
@@ -67,7 +63,7 @@ export class VideoUploader extends AbstractUploader<UploadProgressEvent> {
6763
return res!;
6864
}
6965

70-
private async checkVideoDuration(): Promise<boolean> {
66+
private async isVideoTooLong(): Promise<boolean> {
7167
return new Promise(resolve => {
7268
const video = document.createElement('video');
7369
video.preload = 'metadata';

0 commit comments

Comments
 (0)