refact structure and api implem

This commit is contained in:
wryk
2020-01-20 03:26:18 +01:00
parent 9b47dd5aeb
commit c27804bcb0
11 changed files with 2305 additions and 529 deletions

View File

@ -22,13 +22,16 @@
{#if duration}
{currentTimeText}
<input
type="range"
min="0"
max={duration}
value={currentTime}
on:input={(e) => seek(e.target.value, false)}
on:change={(e) => seek(e.target.value, true)}>
value="0"
on:input={event => updateCurrentTime(event.target.value, false)}
on:change={event => updateCurrentTime(event.target.value, true)}
>
{durationText}
{/if}
</div>
@ -36,7 +39,7 @@
<script>
import { get } from 'svelte/store'
import YoutubePlayer from '/components/YoutubePlayer'
import { secondsToElapsedTime } from '/util.js'
import { secondsToElapsedTime } from '/services/misc.js'
import { paused, muted, volume, current, selectNext, loading } from '/store.js'
let ready = null
@ -52,6 +55,11 @@
$: if (ended || error) {
selectNext()
}
const updateCurrentTime = (seconds, seekAhead) => {
seek(seconds, seekAhead)
currentTime = seconds
}
</script>
<style>