HTML - attributes - onwaiting

revision:


Content

"onwaiting" attribute : whem the video stops for buffering syntax some examples


"onwaiting" attribute : whem the video stops for buffering

top

The onwaiting attribute defines a script to run when the video stops because it needs to buffer the next frame. This event can also be used on <audio> elements, but it is mostly used for videos.

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


syntax

top

<element onwaiting="script"></element>

script: this attribute contains single value script which works when the onwaiting event is called.


some examples

top
codes:

                    <video style="margin-left:3vw;" controls id="videoID" width="400" height="auto">
                        <source src="../../pics/Wuzhen-20-10_02.mp4" type="video/mp4">
                    </video>
                    <script>
                        document.getElementById("videoID").addEventListener("waiting", videoFun());
                
                        function videoFun() {
                            alert("start buffering");
                        }
                    </script>