Latest web development tutorials

HTML Audio / Video DOM ratechange event

HTML audio / video Tag Reference HTML Audio / Video DOM Reference

Examples

To change the video playback speed and eject speed of change ::

// Get id = "myVideo" the <video> element
var vid = document.getElementById ( "myVideo");

// Set the video playback speed is 0.3 (slow)
function setPlaySpeed ​​() {
vid.playbackRate = 0.3;
}

// For the <video> add ratechange events, perform the function of video playback speed when sending change. Function prompted text messages.
vid.onratechange = function () {myFunction ()};

function myFunction () {
alert ( "video playback speed has changed.");
}

try it"

Definition and Usage

ratechange trigger event (such as the user switches to slow or fast playback mode) (audio / video) playback speed changes in the audio / video.

This event via audio / video (audio / video) of playbackRate property called, used to set or return to the audio / video (audio / video) playback speed.


Browser Support

Figures in the table represent the first browser to support this version of events.

event
ratechange Yes 9.0 Yes Yes Yes


grammar

In HTML:

<Audio | video onratechange = "myScript "> try

In JavaScript:

audio | video .onratechange = function () {myScript}; try

JavaScript, use the addEventListener () method:

audio | video .addEventListener ( "ratechange" , myScript); try

Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.


technical details
Supported HTML tags: <Audio> and <video>
Supported JavaScript Objects: Audio, Video


HTML audio / video Tag Reference HTML Audio / Video DOM Reference