Horje
HTML onstalled Attribute

Definition and Usage

The onstalled attribute defines a script to run when the browser is trying to get media data, but data is not available.

Tip: Related events that occurs when there is some kind of disturbance to the media loading process, are:

  • onabort
  • onemptied
  • onerror
  • onsuspend

Applies to

The onstalled attribute is part of the Event Attributes, and can be used on the following elements:

Elements Event
<audio> stalled
<video> stalled

Browser Support

The onstalled attribute has the following browser support for each element:


How to use HTML onstalled Attribute

In this example, we will apply onstalled attribute on the video tag.
index.html
Example: HTML
<!DOCTYPE html> 
<html> 
 
<head> 
    <title> 
        HTML onstalled Attribute 
    </title> 
</head> 
 
<body> 
    <center> 
        <h1 style="color:green">Horje</h1> 
        <h2>HTML onstalled Attribute</h2> 
 
        <video controls id="videoID"> 
            <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_20mb.mp4"
                    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 should be:

How to use  HTML onstalled Attribute




html onstalled attribute

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


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