![]() |
Definition and UsageThe loadeddata event occurs when data for the current frame is loaded, but not enough data to play next frame of the specified audio/video. During the loading process of an audio/video, the following events occur, in this order:
Applies toThe onloadeddata attribute is part of the Event Attributes, and can be used on the following elements:
Browser Support
The
|
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<audio id="myAudio" controls onloadeddata="myFunction()"> <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3" type="audio/ogg"> <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3" type="audio/mpeg"> Your browser does not support the audio element.
</audio>
<p>Play the audio file:</p>
<script>
function myFunction() { alert("Data is loaded");
}
</script>
<p>This example demonstrates how to use the "onloadeddata" attribute on an AUDIO element.</p>
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<video id="myVideo" width="320" height="176" controls onloadeddata="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>
<p>Play the video:</p>
<script>
function myFunction() { alert("Data is loaded");
}
</script>
<p>This example demonstrates how to use the "onloadeddata" 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>
html onloadeddata attribute |
How to Run "myFunction" when the loadeddata event occurs - HTML onloadeddata Attribute | HTML Attribute |
How to Run "myFunction" when the loadeddata event occurs - HTML onloadeddata Attribute | HTML Attribute |
Type
: |
Develop |
Category
: |
Web Tutorial |
Sub Category
: |
HTML Attribute |
Uploaded by
: |
Admin |
Read Article https://horje.com/learn/1434/reference