onplayingEvent

事件对象参考手册Event Object

Example

Execute JavaScript when the video is ready to start playing after being paused:

<video onplaying="myFunction()">

Try it yourself »

More examples are included at the bottom of this article.


Definition and Usage

The onplaying event is triggered when the video/audio (audio/video) is paused or is ready to start playing again after buffering.


Browser Support

The numbers in the table indicate the first browser version that supports this event.

Event
onplaying Yes 9.0 Yes Yes Yes


Syntax

In HTML:

<element onplaying="myScript">Try it yourself

In JavaScript:

object.onplaying=function(){myScript};Try it yourself

In JavaScript, using the addEventListener() method:

object.addEventListener("playing", myScript);Try it yourself

Note:Internet Explorer 8 and earlier IE versions do not supportaddEventListener()method.


Technical Details
Does it bubble: No
Can it be cancelled: No
Event type: Event
Supported HTML tags: <audio>, <video>


Examples

More Examples

Example

Execute JavaScript when the audio is ready to start playing after being paused:

<audio onplaying="myFunction()">

Try it yourself »


事件对象参考手册Event Object Other Extensions