This specification extends the HTMLVideoElement to add new features that can be used to detect the user perceived playback quality.
This document is extracted from the [[media-source]] specification in order to work on the playback quality problematic in a larger scope. It is a proposal for a Web Incubator Community Group specification.

Dependencies

The following concepts and interfaces are defined in [[!HTML]]:

The following concepts and interfaces are defined in [[!hr-time]]:

Concepts

Each HTMLVideoElement MUST maintain a total video frame count variable keeping track of the total number of frames that have been displayed and dropped. It MUST follow these rules:

Each HTMLVideoElement MUST maintain a dropped video frame count variable keeping track of the total number of frames that have been dropped. It MUST follow these rules:

Each HTMLVideoElement MUST maintain a corrupted video frame count variable keeping track of the total number of corrupted frames detected. It MUST follow these rules:

It is up to the implementation to determine whether to display or drop a corrupted frame. However, regardless of the choice made, the total video frame count and dropped video frame count MUST be updated appropriately.

Extension to the HTMLVideoElement

        partial interface HTMLVideoElement {
          VideoPlaybackQuality getVideoPlaybackQuality();
        };
      

When getVideoPlaybackQuality() method is called, the user agent MUST run the following steps:

  1. Let playbackQuality be a new instance of VideoPlaybackQuality.
  2. Set playbackQuality.creationTime to the value returned by a call to Performance.now().
  3. Set playbackQuality.totalVideoFrames to the current value of the total video frame count.
  4. Set playbackQuality.droppedVideoFrames to the current value of the dropped video frame count.
  5. Set playbackQuality.corruptedVideoFrames to the current value of the corrupted video frame count.
  6. Return playbackQuality.

VideoPlaybackQuality interface

        interface VideoPlaybackQuality {
          readonly attribute DOMHighResTimeStamp creationTime;
          readonly attribute unsigned long corruptedVideoFrames;
          readonly attribute unsigned long droppedVideoFrames;
          readonly attribute unsigned long totalVideoFrames;
        };
      

The creationTime attribute MUST return the timestamp returned by Performance.now() when the object was created.

The corruptedVideoFrames attribute MUST return the total number of corrupted frames that have been detected.

The droppedVideoFrames attribute MUST return the total number of frames dropped predecode or dropped because the frame missed its display deadline.

The totalVideoFrames attribute MUST return the total number of frames that would have been displayed if no frames are dropped.