Horje
HTML onplay Event Attribute
The HTML onplay Attribute is a event attribute which occurs when the audio/video is played. The audio/video can be played either by the user or programmatically. Supported Tags: <audio> .

Exanple of HTML onplay Event Attribute

It will alert that the video has started to play.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>
<script>
function myFunction() { alert('The video has started to play');
}
</script>
<p>Press play on the video:</p>
<video controls onplay="myFunction()"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="video/mp4"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="video/ogg"> Your browser does not support HTML5 video.
</video>
<p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>

Output should be:

Exanple of HTML onplay Event Attribute




html event attributes

Related Articles
List of Media Events HTML Media Events Attribute
HTML onabort Event Attrribute HTML Media Events Attribute
HTML oncanplay Event Attribute HTML Media Events Attribute
HTML oncanplaythrough Event Attribute HTML Media Events Attribute
HTML ondurationchange Event Attribute HTML Media Events Attribute
HTML onended Event Attribute HTML Media Events Attribute
HTML onerror Event Attribute HTML Media Events Attribute
HTML onloadeddata Event Attribute HTML Media Events Attribute
HTML onloadedmetadata Event Attribute HTML Media Events Attribute
HTML onloadstart Event Attribute HTML Media Events Attribute
HTML onpause Event Attribute HTML Media Events Attribute
HTML onplay Event Attribute HTML Media Events Attribute

Single Articles
Exanple of HTML onplay Event Attribute HTML Media Events Attribute

Type :
Develop
Category :
Web Tutorial
Sub Category :
HTML Media Events Attribute
Uploaded by :
Admin


Read Article
https://horje.com/learn/1434/reference