File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -1223,9 +1223,21 @@ class YtDownloaderApp {
12231223 let isAVideoSelected = false ;
12241224
12251225 formats . forEach ( ( format ) => {
1226- const size = format . filesize || format . filesize_approx ;
1227- const displaySize = size
1228- ? `${ ( size / 1000000 ) . toFixed ( 2 ) } MB`
1226+ let sizeInMB = null ;
1227+ let isApprox = false ;
1228+
1229+ if ( format . filesize ) {
1230+ sizeInMB = format . filesize / 1000000 ;
1231+ } else if ( format . filesize_approx ) {
1232+ sizeInMB = format . filesize_approx / 1000000 ;
1233+ isApprox = true ;
1234+ } else if ( this . state . videoInfo . duration && format . tbr ) {
1235+ sizeInMB = ( this . state . videoInfo . duration * format . tbr ) / 8192 ;
1236+ isApprox = true ;
1237+ }
1238+
1239+ const displaySize = sizeInMB
1240+ ? `${ isApprox ? "~" : "" } ${ sizeInMB . toFixed ( 2 ) } MB`
12291241 : i18n . __ ( "unknownSize" ) ;
12301242
12311243 if ( format . video_ext !== "none" && format . vcodec !== "none" ) {
You can’t perform that action at this time.
0 commit comments