Example:
HTML
<audio id="myAudio" controls ondurationchange="myFunction(this)"> <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(x) { alert("The duration of this audioclip is : " + x.duration + " seconds");
}
</script>
How to Run "myFunction" when the audio is ready to start playing - HTML ondurationchange Attribute | HTML Attribute |
How to Run "myFunction" when the video is ready to start playing - | HTML Attribute |
Type
: |
html |
Category
: |
Web Tutorial |
Sub Category
: |
HTML Attribute |
Uploaded by
: |
Admin |