Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML Audio/Video DOM seeking Event

HTML Audio/Video DOM seeking Event

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

Example

Display a text message when the user starts moving/jumping to a new video playback position:

var vid = document.getElementById("myVideo");

vid.onseeking = function() {

    alert("Seek operation began!");

};

Try it »

The bottom of this article contains more examples.


Definition and Usage

The seeking event is triggered when the user starts moving/jumping to a new playback position in the audio/video.

Tip: The opposite event of seeking is seeked events.

**Tip:** Use the Audio/Video object's currentTime property to get the playback position.


Browser support

The numbers in the table indicate the version number of the first browser to support the event.

Events
seeking Yes 9.0 Yes Yes Yes

Syntax

In HTML:

<

audio|video

onseeking="

myScript

">

Try it

In JavaScript:

audio|video

.onseeking=function(){

myScript

};

Try it

In JavaScript, use the addEventListener() method:

audio|video

.addEventListener("seeking",

myScript

);

Try it

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


Technical Details

Supported HTML tags:
Supported JavaScript objects: Audio, Video

More examples

Example

This example demonstrates the difference between the seeking and seeked events: