It is my code, just add event listeners to a <video>
:
<script >
import {onMount} from "svelte";
let video
let time
onMount(()=>{
const events=["canplay","canplaythrough","seeked","seeking"]
events.forEach((value)=>{
video.addEventListener(value,()=>{
console.log(value)})
})
})
</script>
<video src="/suzhou.mp4" controls
bind:this={video}
bind:currentTime={time}
></video>
When I changed the progress bar of <video>
, it double triggers events.
if I don’t bind the currentTime, it will only trigger once, which is my expected.