onplaying Event

Definition and Usage

An onplaying event occurs when the audio/video is ready to play after being paused or due to network delay and missing media data.

Example

Example 1

Execute JavaScript when the video is ready after being paused:

<video onplaying="myFunction()">

Try it yourself

Example 2

Execute JavaScript when the audio is ready after being paused:

<audio onplaying="myFunction()">

Try it yourself

Syntax

In HTML:

<element onplaying="myScript">

Try it yourself

In JavaScript:

object.onplaying = function(){myScript};

Try it yourself

In JavaScript, use the addEventListener() method:

object.addEventListener("playing", myScript);

Try it yourself

Note:Internet Explorer 8 or earlier versions do not support addEventListener() Method.

Technical Details

Bubble: Unsupported
Can be canceled: Unsupported
Event Type: Event
Supported HTML Tags: <audio> and <video>
DOM Version: Level 3 Events

Browser Support

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

Events Chrome IE Firefox Safari Opera
onplaying Support 9.0 Support Support Support