onratechange event

Definition and usage

onratechange event occurs when the playback speed of the audio/video changes (for example, when the user switches to slow motion or fast forward mode).

This event is triggered by the audio/video object's playbackRate attribute This property sets or returns the current playback speed of the audio/video.

Example

Execute JavaScript when the video playback speed changes:

<video onratechange="myFunction()">

Try it yourself

Syntax

In HTML:

<element onratechange="myScript">

Try it yourself

In JavaScript:

object.onratechange = function(){myScript};

Try it yourself

In JavaScript, use the addEventListener() method:

object.addEventListener("ratechange", myScript);

Try it yourself

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

Technical details

Bubbling: Not supported
Cancelable: Not supported
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
onratechange Support 9.0 Support Support Support