revision:
The oncanplaythrough event occurs when the browser estimates it can play through the specified audio/video without having to stop for buffering.
The oncanplaythrough attribute is part of the event attributes, and can be used on the following elements:<audio>, <video>.
<audio oncanplaythrough="script"></audio>
<video oncanplaythrough="script"></video>
script: the script to be run on oncanplaythrough.
audio:
<audio style="margin-left:3vw;" id="myAudio" controls
oncanplaythrough="playAudio2()">
<source src="../../pics/horse.wav" type="audio/wav">
Your browser does not support the audio element.
</audio>
<script>
function playAudio2() {
alert("Can play the audio without any buffering");
}
</script>
video:
<video style="margin-left:3vw;" id="myVideo" width="320" height="176" controls
oncanplaythrough="playVideo2()">
<source src="../../pics/Wuzhen-20-10_02.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
<script>
function playVideo2() {
alert("Can play the video without buffering");
}
</script>