onseeked Event

Example

Call a function when a user has seeked a new position in a video:

<video onseeked="myFunction()">
Try it Yourself »

More examples below.


Description

The onseeked event occurs when a user has seeked a new position in a media.

Audio and Video Events

While loading a media, these events occur in the following order:

EventOccurs When
onloadstartThe loading of a media starts
ondurationchangeThe duration of a media is changed
onloadedmetadataThe meta data for a media has been loaded
onloadeddataA media frame is loaded
onprogressThe browser is loading a media
oncanplayAn element's scrollbar is being scrolled
oncanplaythroughThe browser estimates it can play a media
onplayA media starts to play
onplayingA media starts or resumes
ontimeupdateThe indicated time is changed
onendedA media has reached the end

Events that can occur while a media is loading or playing:

EventOccurs When
onabortThe loading of a media is aborted
onemptiedA media is empty (already loaded)
onerrorAn error occurs while loading a media
onpauseA media is paused
onratechangeThe playback rate is changed
onseekedA user has seeked a new media position
onseekingA user start seeking a new media position
onstalledMedia data is not available
onsuspendThe browser is not getting the media data
onvolumechangeThe volume of a media is changed
onwaitingA media is waiting for the next frame

See Also:

The <audio> Object
The <video> Object

Syntax

In HTML:

<element onseeked="myScript">
Try it Yourself »

In JavaScript:

object.onseeked = function(){myScript};
Try it Yourself »

In JavaScript, using the addEventListener() method:

object.addEventListener("seeked", myScript);
Try it Yourself »


Technical Details

Bubbles: No
Cancelable: No
Event type: Event
HTML tags: <audio> and <video>
DOM Version: Level 3 Events

More Examples

Example

This example demonstrates the difference between the onseeking event and onseeked event:

<video onseeking="myFunction()" onseeked="mySecondFunction()">
Try it Yourself »

Example

Using the currentTime property of the Video Object to display the current playtime position when the user is finished moving/skipping to a new position:

// Get the video element:
const video = document.getElementById("myVideo");

// Attach a seeked event to the video element:
video.addEventListener("seeked", myFunction);

// Function to display the time position of the playback:
function myFunction() {
document.getElementById("demo").innerHTML = video.currentTime;
}
Try it Yourself »

Example

Call a function when the user is finished moving/skipping to a new position in the audio:

<audio onseeked="myFunction()">
Try it Yourself »

Browser Support

onseeked is a DOM Level 3 (2004) feature.

It is fully supported in all modern browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.