HTML Audio/Video DOM seekingEvents
HTML Audio/Video DOM Reference Manual
Example
Pop up text information when the user starts moving/jumping to a new video playback position:
vid.onseeking = function() {
alert("Seek operation began!");
};
Try it Yourself »
This article contains more examples at the bottom.
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 the seeking event isseekedEvent.
Tip:Use of Audio/Video objectscurrentTimeAttribute to get the playback position.
Browser Support
The numbers in the table represent the version number of the first browser that supports the event.
| Events | |||||
|---|---|---|---|---|---|
| seeking | Yes | 9.0 | Yes | Yes | Yes |
Syntax
In HTML:
In JavaScript:
In JavaScript, using the addEventListener() method:
Note:Internet Explorer 8 and earlier IE versions do not supportaddEventListener()method.
Technical Details
| 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:
Try it Yourself »
Example
When the user starts moving to a new position, use the currentTime property of the Video object to display the current playback position:
var vid = document.getElementById("myVideo");
// Add seeking event to <video>, if seeking starts, execute the function
vid.addEventListener("seeking", myFunction);
function myFunction() {
// Display the playback position of <video> in the p element with id="demo"
document.getElementById("demo").innerHTML = vid.currentTime;
}
Try it Yourself »
Example
Pop up a prompt message when the user finishes moving/jumping to the new audio playback position:
aud.onseeking = function() {
alert("Seek operation began!");
};
Try it Yourself »
HTML Audio/Video DOM Reference Manualother extensions