HTML onseeking Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The onseeking attribute handles the media seeking event. It fires when a seek starts — the Boolean seeking property becomes true and the media looks for a new playback position.

Use it on <video> or <audio>. Scrub the timeline or set currentTime. Pair with onseeked (seek finished). Prefer addEventListener("seeking", …).

Baseline · Widely available.

Stable across modern browsers since about July 2015. Not deprecated. Not cancelable; does not bubble.

Inline handlers discouraged.

MDN: prefer addEventListener over inline on* attributes. Study onseeking to recognize it in markup.

HTML Syntax

syntax.html
<video onseeking=" script">

script runs when a seek begins. Same idea on <audio>. Preferred: element.addEventListener("seeking", handler).

Attribute Values

How you listen for media seeking:

Value / formDescriptionTry it
JavaScript on mediaInline handler, e.g. showSeek()Try it
addEventListener("seeking")Preferred listener; read currentTimeTry it
With seekedStart/end pair for seek UITry it

Live Preview

Scrub the timeline, or jump with the chips. Status updates when seeking starts.

seek to

Uses /video/count.mp4. Setting currentTime starts a seek.

Demo

Waiting for seeking…

HTML Examples

Short study snippets. Use Try It Yourself for a live editor. Prefer listeners in real apps.

Example 1 — Inline onseeking on video

Recognize the attribute form. Jump the playhead to fire seeking.

HTML
<video
  id="clip"
  width="280"
  controls
  src="/video/count.mp4"
  onseeking="document.getElementById('status').textContent = 'Seeking…'"
></video>
<p id="status">Scrub the timeline or jump.</p>
<button type="button" onclick="document.getElementById('clip').currentTime = 5">Jump to 5s</button>
Try It Yourself

How It Works

  1. onseeking registers an inline media handler.
  2. Scrubbing or setting currentTime starts a seek.
  3. seeking becomes true and the event fires.
  4. Status shows that a seek began.

Example 2 — Preferred addEventListener

Same event; show the target time from currentTime.

HTML
<video id="clip" width="280" controls src="/video/count.mp4"></video>
<p id="status">Waiting…</p>
<button type="button" id="jump">Jump to 2s</button>

<script>
  var video = document.getElementById("clip");
  var status = document.getElementById("status");

  video.addEventListener("seeking", function () {
    status.textContent = "Seeking toward " + video.currentTime.toFixed(1) + "s";
  });

  document.getElementById("jump").addEventListener("click", function () {
    video.currentTime = 2;
  });
</script>
Try It Yourself

How It Works

  1. Listener on video — no inline attribute.
  2. Jump sets currentTime = 2.
  3. On seeking, read currentTime for the destination.
  4. Note: during a seek, currentTime reflects the target being sought.

Example 3 — seeking + seeked

Show “Seeking…” until the new position is ready.

HTML
<video id="clip" width="280" controls src="/video/count.mp4"></video>
<p id="status" aria-live="polite">Idle</p>
<button type="button" id="jump">Jump to 5s</button>

<script>
  var video = document.getElementById("clip");
  var status = document.getElementById("status");

  video.addEventListener("seeking", function () {
    status.textContent = "Seeking…";
  });

  video.addEventListener("seeked", function () {
    status.textContent = "Seeked at " + video.currentTime.toFixed(1) + "s";
  });

  document.getElementById("jump").addEventListener("click", function () {
    video.currentTime = 5;
  });
</script>
Try It Yourself

How It Works

  1. seeking marks the start of a position change.
  2. seeked marks when the seek completed (seeking → false).
  3. UI pattern: show a busy label, then clear it on seeked.
  4. On fast local files, both can feel nearly instant.

Edge Cases & Pitfalls

Seek events are about position changes — not play/pause.

pair

seeking ≠ seeked

Start vs finish. Use seeked when the new position is ready.

target

Listen on the media element

The event does not bubble. Put the handler on <video> / <audio>.

speed

Can be nearly instant

Cached short clips may fire seeking then seeked so fast you barely see the middle state.

vs time

Not timeupdate

timeupdate fires during normal playback progress. seeking is for intentional jumps.

style

Prefer listeners

Inline on* attributes mix concerns. Use addEventListener in production code.

Browser Support

onseeking is a media event handler for seek start on video/audio. Prefer addEventListener in apps.

✓ Baseline · Widely available

onseeking

Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera support the media seeking event.

97% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer 9+
Supported*
seeking Widely supported

Bottom line: *Safe on modern browsers. Pair with seeked for complete seek UI feedback.

Key Takeaways

  • Role: fire when a seek to a new position starts.
  • Trigger: scrub controls or set currentTime.
  • Pair with: seeked when the seek completes.
  • Target: media element (no bubbling).

One line: onseeking marks the start of a media seek — show busy UI, then clear it on seeked.

Frequently Asked Questions

It is an event handler for the seeking event on media elements. That event fires when a seek starts — the media is looking for a new playback position and the seeking property becomes true.
seeking fires when the seek begins. seeked fires when the seek finishes and seeking becomes false. Use them as a start/end pair for seek UI.
Scrub the timeline in the media controls, or set media.currentTime in JavaScript (for example video.currentTime = 5).
No. It is not cancelable and does not bubble. Listen on the <video> or <audio> element itself.
Prefer addEventListener("seeking", handler). MDN discourages inline HTML event handler attributes.
Show a “seeking…” label, pause related UI, or log seek starts. Pair with seeked to clear the label when the new position is ready.

Next: onselect

React when text inside an input or textarea is selected.

onselect tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful