VideoPlaybackQuality: corruptedVideoFrames property

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Thuộc tính chỉ đọc corruptedVideoFrames của giao diện VideoPlaybackQuality cho biết số khung hình video bị hỏng đã được nhận kể từ khi phần tử <video> được tải hoặc tải lại lần cuối.

Giá trị

Số khung hình video bị hỏng đã được nhận kể từ khi phần tử <video> được tải hoặc tải lại lần cuối.

Tùy thuộc vào user agent để xác định xem có hiển thị khung hình video bị hỏng hay không. Nếu một khung hình bị hỏng bị bỏ, thì cả corruptedVideoFramesdroppedVideoFrames đều được tăng lên.

Ví dụ

Ví dụ này xác định tỷ lệ phần trăm khung hình bị hỏng, và nếu giá trị lớn hơn 5%, sẽ gọi hàm downgradeVideo() để chuyển sang video ít tải mạng hơn.

js
const videoElem = document.getElementById("my_vid");
const quality = videoElem.getVideoPlaybackQuality();

if (quality.corruptedVideoFrames / quality.totalVideoFrames > 0.05) {
  downgradeVideo(videoElem);
}

Thông số kỹ thuật

Specification
Media Playback Quality
# dom-videoplaybackquality-corruptedvideoframes

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

Xem thêm