mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-29 11:06:10 +00:00
web/remux: add speed to progress info
This commit is contained in:
parent
4c2acc595e
commit
1493762ce9
|
@ -11,13 +11,18 @@
|
|||
|
||||
let totalDuration: number | undefined;
|
||||
let processedDuration: number | undefined;
|
||||
let speed: number | undefined;
|
||||
let progress = '';
|
||||
|
||||
$: {
|
||||
if (totalDuration && processedDuration && processing) {
|
||||
const percentage = ((processedDuration / totalDuration) * 100).toFixed(2);
|
||||
progress = `(${percentage}%)`;
|
||||
} else progress = '';
|
||||
if (totalDuration && processedDuration) {
|
||||
const percentage = Math.min(100, (processedDuration / totalDuration) * 100).toFixed(2);
|
||||
progress = `${percentage}%, ${speed}x`;
|
||||
} else if (processing) {
|
||||
progress = 'getting video metadata';
|
||||
} else {
|
||||
progress = '';
|
||||
}
|
||||
}
|
||||
|
||||
let processing = false;
|
||||
|
@ -26,6 +31,10 @@
|
|||
if (progress.out_time_sec) {
|
||||
processedDuration = progress.out_time_sec;
|
||||
}
|
||||
|
||||
if (progress.speed) {
|
||||
speed = progress.speed;
|
||||
}
|
||||
});
|
||||
|
||||
ff.init();
|
||||
|
@ -83,7 +92,7 @@
|
|||
|
||||
<div id="remux-processing" class:processing>
|
||||
{#if processing}
|
||||
processing... {progress}
|
||||
processing{progress ? ` (${(progress)})` : ''}...
|
||||
{:else}
|
||||
done!
|
||||
{/if}
|
||||
|
|
Loading…
Reference in a new issue