HTMLMediaElement: sự kiện seeked

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Sự kiện seeked được kích hoạt khi thao tác tìm kiếm hoàn tất, vị trí phát lại hiện tại đã thay đổi và thuộc tính Boolean seeking được thay đổi thành false.

Sự kiện này không thể hủy và không bong bóng.

Cú pháp

Sử dụng tên sự kiện trong các phương thức như addEventListener() hoặc đặt thuộc tính xử lý sự kiện.

js
addEventListener("seeked", (event) => { })

onseeked = (event) => { }

Kiểu sự kiện

Một Event chung chung.

Ví dụ

Các ví dụ này thêm trình xử lý sự kiện cho sự kiện seeked của HTMLMediaElement, sau đó đăng thông báo khi trình xử lý sự kiện đó phản ứng với việc kích hoạt sự kiện.

Sử dụng addEventListener():

js
const video = document.querySelector("video");

video.addEventListener("seeked", (event) => {
  console.log("Video found the playback position it was looking for.");
});

Sử dụng thuộc tính xử lý sự kiện onseeked:

js
const video = document.querySelector("video");

video.onseeked = (event) => {
  console.log("Video found the playback position it was looking for.");
};

Đặc tả kỹ thuật

Specification
HTML
# event-media-seeked
HTML
# handler-onseeked

Tương thích trình duyệt

Sự kiện liên quan

Xem thêm