Horje
HTML onplaying Event Attributes
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>.

Example of HTML onplaying Event Attributes

It will alert that the video is playing.
index.html
Example: HTML
 <script>
function myFunction() { alert('The video is now playing');
}
</script>
<video onplaying="myFunction()"> 

Output should be:

Example of HTML onplaying Event Attributes

Definition and Usage of HTML onplaying Event Attributes

The playing event occurs when the audio/video is playing. It will also occur when the audio/video starts after buffering.

Browser Support of HTML onplaying Event Attributes

The numbers in the table specify the first browser version that fully supports the event.

Browser Support of HTML onplaying Event Attributes

Syntax of HTML onplaying Event Attributes

< element onplaying=" script ">

Attribute Values of HTML onplaying Event Attributes

Value Description
script The script to be run when the audio/video starts playing

Technical Details of HTML onplaying Event Attributes

Supported HTML tags: <audio> and <video>

Alert that the audio is playing

It will press play on the video.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>
<script>
function myFunction() { alert('The audio is now playing');
}
</script>
<p>Press play on the audio.</p>
<audio controls onplaying="myFunction()"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="audio/ogg"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="audio/mpeg"> Your browser does not support the audio element.
</audio>
</body>
</html>

Output should be:

Alert that the audio is playing




html event attributes

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


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