Closed antonkristiono closed 1 year ago
Thanks @antonkristiono to reaching out.
You can pause/stop the audio by adding another event listener as of v0.3.0
<script lang="ts">
import { sound } from "svelte-sound";
import click_mp3 from "/assets/click.mp3";
let count: number = 0
const increment = () => {
count += 1
}
</script>
<!-- below the sound starts when "mouseover" event is triggered and stops when "mouseleave" event is triggered -->
<button on:click={increment} use:sound={{src:click_mp3, events:["mouseover", "mouseleave"] }}>
count is {count}
</button>
So, basically you have to just add another event to the events array and it will be used to stop the sound playback.
v0.5.0
's FAQThis issue has been fixed and there is no activity (response) from the reporter. so closing this issue
how to pause the audio