File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -49,14 +49,10 @@ export class VideoUploader extends AbstractUploader<UploadProgressEvent> {
49
49
50
50
51
51
public async upload ( ) : Promise < VideoUploadResponse > {
52
- if ( this . maxVideoDuration !== null && ! document ) {
52
+ if ( this . maxVideoDuration !== undefined && ! document ) {
53
53
throw Error ( 'document is undefined. Impossible to use the maxVideoDuration option. Remove it and try again.' )
54
54
}
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 ( ) ) {
60
56
throw Error ( `The video submitted is too long.` ) ;
61
57
}
62
58
let res : VideoUploadResponse ;
@@ -67,7 +63,7 @@ export class VideoUploader extends AbstractUploader<UploadProgressEvent> {
67
63
return res ! ;
68
64
}
69
65
70
- private async checkVideoDuration ( ) : Promise < boolean > {
66
+ private async isVideoTooLong ( ) : Promise < boolean > {
71
67
return new Promise ( resolve => {
72
68
const video = document . createElement ( 'video' ) ;
73
69
video . preload = 'metadata' ;
You can’t perform that action at this time.
0 commit comments