``` More examples are"> ``` More examples are" />
Easy Tutorial
❮ Prop Param Value Jsref Sort ❯

onseeking Event

Event Object

Example

Execute JavaScript when the user starts to reposition the playback position of a video:

<video onseeking="myFunction()">

More examples are included at the bottom of this page.


Definition and Usage

The onseeking event is triggered when the user starts to reposition the video/audio (audio/video).

Tip: The opposite of the onseeking event is the onseeked event.

Tip: Use the currentTime property to set or return the current playback position of the video/audio (audio/video).


Browser Support

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

Event Chrome IE Firefox Safari Opera
onseeking 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.


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

More Examples

Example

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

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

Example

When the user starts to reposition the playback position, you can use the currentTime property of the Video object to display the current playback position:

// Get the <video> element with id="myVideo"
var x = document.getElementById("myVideo");
// If seeking starts, add the seeking event to <video> and execute the corresponding function
x.addEventListener("seeking", myFunction);
function myFunction() {
    // Display the current playback position in the <p> element with id="demo"
    document.getElementById("demo").innerHTML = x.currentTime;
}

Example

Execute JavaScript when the user starts to reposition the playback position of an audio:

<audio onseeking="myFunction()">

❮ Prop Param Value Jsref Sort ❯