fix progress

This commit is contained in:
wryk 2020-02-15 23:54:32 +01:00
parent 61dd44093c
commit 9fc0c52973
2 changed files with 9 additions and 11 deletions

View File

@ -24,8 +24,6 @@
<Progress <Progress
duration={duration} duration={duration}
currentTime={currentTime} currentTime={currentTime}
currentTimeText={currentTimeText}
durationText={durationText}
on:input={event => updateCurrentTime(event.target.value, false)} on:input={event => updateCurrentTime(event.target.value, false)}
on:change={event => updateCurrentTime(event.target.value, true)} on:change={event => updateCurrentTime(event.target.value, true)}
></Progress> ></Progress>
@ -35,7 +33,6 @@
import { get } from 'svelte/store' import { get } from 'svelte/store'
import YoutubePlayer from '/components/YoutubePlayer' import YoutubePlayer from '/components/YoutubePlayer'
import Progress from '/components/player/Progress' import Progress from '/components/player/Progress'
import { secondsToElapsedTime } from '/services/misc.js'
import { paused, muted, volume, current, selectNext, loading } from '/store.js' import { paused, muted, volume, current, selectNext, loading } from '/store.js'
let ready = null let ready = null
@ -45,9 +42,6 @@
let duration = null let duration = null
let seek = null let seek = null
$: currentTimeText = currentTime !== null ? secondsToElapsedTime(currentTime) : '--:--'
$: durationText = duration !== null ? secondsToElapsedTime(duration) : '--:--'
$: if (ended || error) { $: if (ended || error) {
selectNext() selectNext()
} }

View File

@ -6,8 +6,8 @@
class="playerProgress__progressInput" class="playerProgress__progressInput"
type="range" type="range"
min="0" min="0"
max={duration} max={max}
value="{currentTime}" value={value}
on:input on:input
on:change on:change
disabled={currentTime === null || duration === null} disabled={currentTime === null || duration === null}
@ -19,10 +19,14 @@
</div> </div>
</div> </div>
<script> <script>
import { secondsToElapsedTime } from '/services/misc.js'
export let duration export let duration
export let currentTime export let currentTime
export let currentTimeText
export let durationText
$: currentPercent = currentTime ? (currentTime / duration) * 100 : 0 $: value = currentTime != null ? currentTime : 0
$: max = duration != null ? duration : 100
$: currentPercent = currentTime != null ? (currentTime / duration) * 100 : 0
$: currentTimeText = currentTime != null ? secondsToElapsedTime(currentTime) : '--:--'
$: durationText = duration != null ? secondsToElapsedTime(duration) : '--:--'
</script> </script>