HTML - attributes - onemptied

revision:


Content

"onemptied" attribute : when playlist is empty syntax some examples


"onemptied" attribute : when playlist is empty

top

The attribute fires when the current playlist is empty. The attribute is used to trigger an event when the media encounters some fatal error, or the media file becomes unavailable, or the media playlist is empty.

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


syntax

top

<element onemptied="scriptFunction()"></element >

This attribute contains a single value script, which works when media is empty by using the onemptied attribute.


some examples

top
codes:
                    <video width="320" height="240" controls onemptied="onEmptied()">
                        <source src="../../pics/Wuzhen-20-10_02.mp4" type="video/mp4">
                    </video>    
                    <script>
                        function onEmptied() {
                            alert("the video playlist is empty!");
                        }
                    </script>