Add approx size calculation based on bitrate

pull/359/head
aandrew-me 1 week ago
parent 59d1f138e0
commit d8c351a2e1

@ -1223,9 +1223,21 @@ class YtDownloaderApp {
let isAVideoSelected = false; let isAVideoSelected = false;
formats.forEach((format) => { formats.forEach((format) => {
const size = format.filesize || format.filesize_approx; let sizeInMB = null;
const displaySize = size let isApprox = false;
? `${(size / 1000000).toFixed(2)} MB`
if (format.filesize) {
sizeInMB = format.filesize / 1000000;
} else if (format.filesize_approx) {
sizeInMB = format.filesize_approx / 1000000;
isApprox = true;
} else if (this.state.videoInfo.duration && format.tbr) {
sizeInMB = (this.state.videoInfo.duration * format.tbr) / 8192;
isApprox = true;
}
const displaySize = sizeInMB
? `${isApprox ? "~" : ""}${sizeInMB.toFixed(2)} MB`
: i18n.__("unknownSize"); : i18n.__("unknownSize");
if (format.video_ext !== "none" && format.vcodec !== "none") { if (format.video_ext !== "none" && format.vcodec !== "none") {

Loading…
Cancel
Save