HTML - attributes - onplaying

revision:


Content

"onplaying" attribute : when audio/video is playing syntax some examples


"onplaying" attribute : when audio/video is playing

top

The onplaying event occurs when the audio/video is playing after having been paused or stopped for buffering.

Supported HTML tags: <audio> and <video>.


syntax

top

<element onplaying="script"></element>

script: this attribute contains a "single value script", which works when the onplaying event attribute is called.


some examples

top

play, pause and then play the video again.

codes:>
                    <p class="spec">play, pause and then play the video again.</p>
                    <video style="margin-left:3vw;" width="400" height="auto" controls onplaying="playVid()">
                        <source src="../../pics/Wuzhen-20-10_02.mp4" type="video/mp4">
                        Your browser does not support HTML5 video.
                    </video>
                    <script>
                        function playVid() {
                        alert("The video is now playing");
                        }
                    </script>
                

Play, pause and then play the audio again.

codes:
                    <p class="spec">Play, pause and then play the audio again.</p>
                    <audio style="margin-left:3vw;" controls onplaying="playAud()">                                              
                    <source src="../../pics/horse.wav" type="audio/wav">
                    Your browser does not support the audio element.
                    </audio>
                    <script>
                        function playAud() {
                        alert("The audio is now playing");
                        }
                    </script>