HTML Audio/Video DOM seeking
Event
HTML Audio/Video DOM Reference Manual
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!");
};
More examples are included at the bottom of this page.
Definition and Usage
The seeking
event is triggered when the user starts moving/jumping to a new audio/video playback position.
Tip: The opposite event of seeking
is the seeked event.
Tip: Use the Audio/Video object's currentTime property to get the playback position.
Browser Support
The numbers in the table specify the first browser version that fully supports the event.
Event | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
seeking | Yes | 9.0 | Yes | Yes | Yes |
Syntax
In HTML:
In JavaScript:
In JavaScript, using the addEventListener() method:
Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions.
Supported HTML Tags: | <audio> and <video> |
---|---|
Supported JavaScript Objects: | Audio, Video |
--- | --- |
More Examples
Example
This example demonstrates the difference between the seeking
event and the seeked
event:
Example
Display the current playback position using the Video object's currentTime
property when the user starts moving to a new position:
Example
Display a prompt message when the user completes moving/jumping to a new audio playback position: