HTML Audio / Video DOM sẵn sàng

❮ Tham chiếu DOM Audio / Video HTML

Thí dụ

Nhận trạng thái sẵn sàng hiện tại của video:

var vid = document.getElementById("myVideo");
alert(vid.readyState);

Định nghĩa và Cách sử dụng

Thuộc tính readyState trả về trạng thái sẵn sàng hiện tại của âm thanh / video.

Trạng thái sẵn sàng cho biết âm thanh / video đã sẵn sàng để phát hay chưa.

Lưu ý: Thuộc tính này là chỉ đọc.


Hỗ trợ trình duyệt

Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.

Property
readyState Yes 9.0 3.5 Yes Yes

Cú pháp

audio|video.readyState

Giá trị trả lại

Type Description
Number Represents the ready state of the audio/video element:
  • 0 = HAVE_NOTHING - no information whether or not the audio/video is ready
  • 1 = HAVE_METADATA - metadata for the audio/video is ready
  • 2 = HAVE_CURRENT_DATA - data for the current playback position is available, but not enough data to play next frame/millisecond
  • 3 = HAVE_FUTURE_DATA - data for the current and at least the next frame is available
  • 4 = HAVE_ENOUGH_DATA - enough data available to start playing

❮ Tham chiếu DOM Audio / Video HTML