onseeked event

Definition and Usage

An onseeked event occurs when the user completes moving/skipping to a new position in the audio/video.

Tip:onseeked event with onseeking EventConversely.

Tip:Please use the audio/video object's currentTime PropertyGet the current playback position.

Example

Execute JavaScript when the user completes moving/jumping to a new position in the video:

<video onseeked="myFunction()">

Try It Yourself

More TIY examples are at the bottom of the page.

Syntax

In HTML:

<element onseeked="myScript">

Try It Yourself

In JavaScript:

object.onseeked = function(){myScript};

Try It Yourself

In JavaScript, use the addEventListener() method:

object.addEventListener("seeked", myScript);

Try It Yourself

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

Technical details

Bubble: Not supported
Cancelable: Not supported
Event type: Event
Supported HTML tags: <audio> and <video>
DOM version: Level 3 Events

Browser support

The numbers in the table indicate the first browser version that fully supports this event.

Event Chrome IE Firefox Safari Opera
onseeked Support 9.0 Support Support Support

More examples

Example

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

<video onseeking="myFunction()" onseeked="mySecondFunction()">

Try It Yourself

Example

When the user completes moving/jumping to a new position, use the Video object's currentTime property to display the current playtime position:

// Get the <video> element with id="myVideo"
var x = document.getElementById("myVideo");
// Attach a seeked event to the <video> to execute a function when a seek operation is completed
x.addEventListener("seeked", myFunction); 
function myFunction() {
  // Display the current position of the video in the <p> element with id="demo"
  document.getElementById("demo").innerHTML = x.currentTime; 
}

Try It Yourself

Example

Execute JavaScript when the user completes moving/jumping to a new position in the audio:

<audio onseeked="myFunction()">

Try It Yourself