Evento onseeked

Definizione e uso

Si verifica l'evento onseeked quando l'utente completa il movimento/salta a una nuova posizione nell'audio/video.

Suggerimento:l'evento onseeked con Evento onseekingAl contrario.

Suggerimento:Utilizzare l'oggetto audio/video Proprietà currentTimeGet the current playback position.

Esempio

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

<video onseeked="myFunction()">

Prova da solo

More TIY examples are at the bottom of the page.

Syntax

In HTML:

<element onseeked="myScript">

Prova da solo

In JavaScript:

object.onseeked = function(){myScript};

Prova da solo

In JavaScript, use the addEventListener() method:

object.addEventListener("seeked", myScript);

Prova da solo

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 the event.

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

More examples

Esempio

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

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

Prova da solo

Esempio

When the user completes moving/jumping to a new position, use the currentTime property of the Video object 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() {
  // In the <p> element with id="demo", display the current position of the video
  document.getElementById("demo").innerHTML = x.currentTime; 
}

Prova da solo

Esempio

Esegui JavaScript quando l'utente completa il movimento/salti a una nuova posizione nell'audio:

<audio onseeked="myFunction()">

Prova da solo