Video Example. This example demonstrates how to use the "onplaying" attribute on a VIDEO element.
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<p>Play the video.</p>
<video id="myVideo" width="320" height="176" controls onplaying="myFunction()"> <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_2mb.mp4" type="video/mp4"> <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_2mb.mp4" type="video/ogg"> Your browser does not support HTML5 video.
</video>
<script>
function myFunction() { alert("The video has started playing");
}
</script>
<p>This example demonstrates how to use the "onplaying" attribute on a VIDEO element.</p>
<p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>
How to Run "myFunction" when the audio file is being played - HTML onplaying Attribute | HTML Attribute |
How to Run "myFunction" when the video is being played - HTML onplaying Attribute | HTML Attribute |
Type
: |
html |
Category
: |
Web Tutorial |
Sub Category
: |
HTML Attribute |
Uploaded by
: |
Admin |