HTML onstalled Attribute
Last Updated :
14 Aug, 2021
The HTML onstalled Attribute is an event attribute that occurs when media data get by the browser but the data is not available.
Supported Tags:
Syntax:
<element onstalled="myScript">
Attribute Value: This attribute contains a single value script that works when onstalled event attribute calls. This attribute is supported by <audio> and <video> tags.
Example 1: In this example, we will apply onstalled attribute on the video tag.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
HTML onstalled Attribute
</ title >
</ head >
< body >
< center >
< h1 style = "color:green" >GeeksforGeeks</ h1 >
< h2 >HTML onstalled Attribute</ h2 >
< video controls id = "videoID" >
< source src =
type = "video/mp4" >
</ video >
</ center >
< script >
document.getElementById(
"videoID").addEventListener("stalled", GFGfun);
function GFGfun() {
alert(
"Data of this media not available");
}
</ script >
</ body >
</ html >
|
Output:
Example 2: In this example, we will apply onstalled attribute on the audio tag.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
HTML onstalled Attribute
</ title >
</ head >
< body >
< center >
< h1 style = "color:green" >GeeksforGeeks</ h1 >
< h2 >HTML onstalled Attribute</ h2 >
< audio controls id = "audioID" >
< source src =
type = "audio/ogg" >
</ audio >
</ center >
< script >
document.getElementById(
"audioID").addEventListener("stalled", GFGfun);
function GFGfun() {
alert(
"Data of this media not available");
}
</ script >
</ body >
</ html >
|
Output
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...