passes duration to slot props

This commit is contained in:
Ollie Taylor
2023-02-22 00:29:57 +00:00
parent 8afc23cbac
commit 07212fc671
2 changed files with 22 additions and 19 deletions
+1
View File
@@ -67,4 +67,5 @@
on:emptied={(e) => console.log('emptied', e)} on:emptied={(e) => console.log('emptied', e)}
on:load={(e) => console.log('load', e)} on:load={(e) => console.log('load', e)}
/> />
<slot {duration} />
{/key} {/key}
+4 -2
View File
@@ -19,8 +19,8 @@
{playbackRate} {playbackRate}
{paused} {paused}
bind:currentTime bind:currentTime
/> let:duration
>
<h5>Custom audio controls</h5> <h5>Custom audio controls</h5>
<h6>Audio Actions</h6> <h6>Audio Actions</h6>
@@ -34,6 +34,7 @@
<button type="button" on:click={() => (currentTime = currentTime + 5)}>Skip 5s</button> <button type="button" on:click={() => (currentTime = currentTime + 5)}>Skip 5s</button>
<button type="button" on:click={() => (currentTime = currentTime - 5)}>Rewind 5s</button> <button type="button" on:click={() => (currentTime = currentTime - 5)}>Rewind 5s</button>
<button type="button" on:click={() => (currentTime = 30)}>Go to 30s</button> <button type="button" on:click={() => (currentTime = 30)}>Go to 30s</button>
<button type="button" on:click={() => (currentTime = duration - 30)}>Go to 30s before end</button>
<h6>Playback Rate</h6> <h6>Playback Rate</h6>
@@ -46,3 +47,4 @@
{#each [0, 0.25, 0.5, 0.75, 1] as v} {#each [0, 0.25, 0.5, 0.75, 1] as v}
<button type="button" on:click={() => (volume = v)}>{v * 100}%</button> <button type="button" on:click={() => (volume = v)}>{v * 100}%</button>
{/each} {/each}
</Audio>