HTML - attributes - onstalled

revision:


Content

onstalled" attribute : when the browser tries to get media data syntax some examples


"onstalled" attribute : when the browser tries to get media data

top

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

The onstalled attribute is part of the event attributes and can be used on the following elements: <audio> and <video>.


syntax

top

<element onstalled="script"></element>

script: the script to be run on onstalled.


some examples

top

codes:
                    <video style="margin-left:3vw;" controls id="videoID">
                        <source src="../../pics/Wuzhen-20-10_03.mp4"  type="video/mp4">
                    </video>
                    <p class="spec" id="pep-1"></p>
                    <script>
                        document.getElementById("videoID").addEventListener("stalled", 
                        someFunc);
                
                        function someFunc() {
                            document.getElementById("pep-1").innerHTML = "Data of this 
                            media not available";
                            
                        }
                        someFunc();
                    </script>