Skip to content

Commit 3784b06

Browse files
committed
synced video to playback rate rather than timeupdate event
1 parent 0ccf761 commit 3784b06

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

video-canvas.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
}
4141
});
4242

43-
addEvent(video, 'timeupdate', function () {
44-
position.innerHTML = asTime(this.currentTime);
43+
setInterval(function () {
44+
position.innerHTML = asTime(video.currentTime);
4545

4646
// ctx.restore();
4747
ctx.drawImage(video, 0, 0, video.width, video.height, 0, 0, canvas.width, canvas.height);
48-
});
48+
}, 1000 / 15);
4949

5050
addEvent(video, 'ended', function () {
5151
togglePlay.value = "play";
@@ -92,4 +92,4 @@
9292
}
9393
</script>
9494
</body>
95-
</html>
95+
</html>

0 commit comments

Comments
 (0)