Latest web development tutorials

HTML Audio / Video DOM seeked event

HTML audio / video Tag Reference HTML Audio / Video DOM Reference

Examples

Prompted text when the user completes re-set the video playback position:

var vid = document.getElementById ( "myVideo");
vid.onseeked = function () {
alert ( "Seek operation completed!");
};

try it"

Bottom of this article contains more examples.


Definition and Usage

Seeked event is triggered when the user has to move / jump to the audio / video (audio / video) to a new location.

Tip: Instead event seeked event is seeking event.

Tip: Use the Audio / Video object currentTime property to get the video playback position.


Browser Support

Figures in the table represent the first browser to support this version of events.

event
seeked Yes 9.0 Yes Yes Yes


grammar

In HTML:

<Audio | video onseeked = "myScript "> try

In JavaScript:

audio | video .onseeked = function () {myScript}; try

JavaScript, use the addEventListener () method:

audio | video .addEventListener ( "seeked" , myScript); try

Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.


technical details
Supported HTML tags: <Audio> and <video>
Supported JavaScript Objects: Audio, Video


Examples

More examples

Examples

This example demonstrates the difference between seeking and seeked event event:

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

try it"

Examples

When the user completes move / jump to the new position of the video, use currentTime property Video object to display the current playback position:

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

// For the <video> add seeked event, after the operation is completed the addressing function is executed
vid.addEventListener ( "seeked", myFunction);

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

try it"

Examples

A message appears upon completion of move / jump to the audio playback position in a new user:

var aud = document.getElementById ( "myAudio");
aud.onseeked = function () {
alert ( "Seek operation completed!");
};

try it"


HTML audio / video Tag Reference HTML Audio / Video DOM Reference