Advertisement
Home Open Editor ❯

HTML Audio/Video DOM playing Event

Example

//Accessing the element
var vid = document.getElementById("myVideo");

//Creating a function
vid.onplaying = function() {
    alert("The video is playing");
};

Try this code ❯

Meaning

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


Standard Syntax

HTML:

<element onplaying="myScript">

JavaScript:

object.onplaying=function(){myScript};

JavaScript, using the addEventListener() method::

object.addEventListener("playing", myScript);


Advertisement

Technical Details

Type Description
Supported HTML tags: <audio> and <video>
Supported JavaScript objects: Audio, Video
Home Open Editor ❯
Advertisement