It will show up a popup that audio is ready to play.
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<script>
function myFunction() {
alert("Can start playing audio");
}
</script>
<audio controls oncanplay="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>
</body>
</html>
Example of HTML oncanplay Event Attribute | Media Events Attribute |
Definition and Usage of HTML oncanplay Event Attribute | Media Events Attribute |
Browser Support of HTML oncanplay Event Attribute | Media Events Attribute |
Syntax of HTML oncanplay Event Attribute | Media Events Attribute |
Attribute Values of HTML oncanplay Event Attribute | Media Events Attribute |
Technical Details of HTML oncanplay Event Attribute | Media Events Attribute |
How to execute a JavaScript when a video is ready to start playing | Media Events Attribute |
How to execute a JavaScript when an audio is ready to start playing | Media Events Attribute |
List of Media Events | Media Events Attribute |
HTML onabort Event Attrribute | Media Events Attribute |
HTML oncanplay Event Attribute | Media Events Attribute |
HTML oncanplaythrough Event Attribute | Media Events Attribute |
HTML ondurationchange Event Attribute | Media Events Attribute |
HTML onended Event Attribute | Media Events Attribute |
Type: | html |
Category: | Web Tutorial |
Sub Category: | Media Events Attribute |
Uploaded by: | Admin |