Horje

How to Run "myFunction" when the audio is ready to start playing - Audio Example

Audio Example.
index.html
Example: HTML
<audio id="myAudio" controls oncanplaythrough="myFunction()">
  <source src="https://download.samplelib.com/mp3/sample-3s.mp3" type="audio/ogg">
  <source src="https://download.samplelib.com/mp3/sample-3s.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

<script>
function myFunction() {
  alert("Can play the audio without any buffering");
}
</script> 

Output should be:

How to Run "myFunction" when the audio is ready to start playing - Audio Example




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin