onseekedEvent

事件对象参考手册Event Object

Example

Execute JavaScript after the user repositions the playback position of the video:

<video onseeked="myFunction()">

Try it yourself »

More examples are included at the bottom of this article.


Definition and Usage

The onseeked event fires after the user repositions the playback position of the audio/video.

Note:The opposite of the onseeked event isonseekingevent.

Note:Use currentTimeto set or return the current playback position of the audio/video.


Browser Support

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

Event
onseeked Yes 9.0 Yes Yes Yes


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

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


Technical Details
Bubbles: No
Cancelable: No
Event type: Event
Supported HTML tags: <audio>, <video>


Examples

More Examples

Example

The following example demonstrates the difference between the onseeking event and the onseeked event:

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

Try it yourself »

Example

After the user repositions the video playback position, the currentTime property of the Video object can be used to display the current playback position:

// Get the <video> element with id="myVideo"
var x = document.getElementById("myVideo");

// If seeking is complete, add the seeked event to the <video> and execute the corresponding function
x.addEventListener("seeked", myFunction);

function myFunction() {
// Display the current video playback position in the <p> element with id="demo"
    document.getElementById("demo").innerHTML = x.currentTime;
}

Try it yourself »

Example

Execute JavaScript after the audio repositions the playback position:

<audio onseeked="myFunction()">

Try it yourself »


事件对象参考手册Event Object Other Extensions