diff --git a/src/components/Viewer.svelte b/src/components/Viewer.svelte index 18a1d56..faacf70 100644 --- a/src/components/Viewer.svelte +++ b/src/components/Viewer.svelte @@ -1,13 +1,13 @@
-
+
{#if duration} - {Math.round(currentTime)} / {Math.round(duration)} + {currentTimeText} + {durationText} {/if} -
\ No newline at end of file diff --git a/src/util.js b/src/util.js index 69aa5fd..d646d6c 100644 --- a/src/util.js +++ b/src/util.js @@ -4,6 +4,20 @@ import { execPipe, asyncFilter, asyncMap } from 'iter-tools' const millisecond = 1 const second = 1000 * millisecond const minute = 60 * second +const hour = 60 * minute + +export const secondsToElapsedTime = (seconds) => { + const parts = [ + Math.floor(seconds / 3600), + Math.floor(seconds / 60) % 60, + Math.floor(seconds) % 60 + ] + + return parts + .filter((value, index) => value > 0 || index > 0) + .map(value => value < 10 ? '0' + value : value) + .join(':') +} export async function* mkStatusesIterator(initialLink) { let buffer = []