CKTIS / HTML
onseeked — handling completed media seeking
The onseeked attribute specifies JavaScript to run for the seeked event. On audio and video elements, this event signals that a seek has completed, not that media playback has ended.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
onseeked="JavaScript"onseeked is an event handler content attribute for seeked. Its value contains JavaScript code. A typical use is updating the interface after seeking finishes on an audio or video element.
For an actual seek, seeked signals that the seek has completed and the seeking property has become false. A seek to the current playback position can complete and fire seeked without changing that position. In contrast, the seeking event signals that a seek has started. Completing a seek does not mean the media has ended or guarantee that playback is running.
Distinguish the attribute name onseeked from the event name seeked. In JavaScript, you can also assign a function to media.onseeked or register a listener with media.addEventListener('seeked', handler). The attribute takes code, whereas assignment to the property takes a function.
The example deliberately dispatches a synthetic event without a media file. The result seeked confirms only that the handler ran; it does not demonstrate an actual seek. Run the file locally in a browser with JavaScript and inline event handlers enabled.
Examples
<!doctype html>
<meta charset="utf-8">
<title>onseeked</title>
<audio id="media" onseeked="document.getElementById('result').textContent = event.type"></audio>
<output id="result">pending</output>
<script>
const media = document.getElementById('media');
media.dispatchEvent(new Event('seeked'));
</script>Result
seeked
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.