|
|
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>.
|
<script>
function myFunction() {
alert('The video is now playing');
}
</script>
<video onplaying="myFunction()">
The playing event occurs when the audio/video is playing. It will also occur when the audio/video starts after buffering.
The numbers in the table specify the first browser version that fully supports the event.
<element onplaying="script">
| Value | Description |
|---|---|
| script | The script to be run when the audio/video starts playing |
| Supported HTML tags: | <audio> and <video> |
|---|
It will press play on the video.
<!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>
| html event attributes |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Media Events Attribute |
Uploaded by: | Admin |
Read Articlehttps://develop.horje.com/learn/1434/reference