MPTF/HTML adaptive calls

From Web and TV IG
Jump to: navigation, search

Adaptive Bitrate calls for HTML5 <video> tag


A content provider may wish to have the ability to fully control the logic for an adaptive client. In order to do so the content provider will need mechanisms to override the default adaptive logic within the user agent.


The WHATWG wiki (Video Metrics, Adaptive Streaming) has already proposed some additions to allow adaptive bitrate control. The Video Metrics proposal allows a user agent to make bandwidth measurements and the Adaptive Streaming proposal contains a good initial set of APIs for adaptive streaming control.

There are three different modes proposed on the WHATWG wiki for adaptive streaming:

  1. Play an adaptive stream with the user aggent's inbuilt heuristics
  2. Play an adaptive stream by disabling the user agent's inbuilt heuristics by actively setting a stream level. Any subsequent changes will need to be set manually.
  3. Play an adaptive stream on a user agent that doesn't support manifest file parsing. All the parsing and decision making is done in JavaScript.

For mode 2. there are some APIs proposed here. The following alterations/ additions are suggested:

  • Change the setLevel API to:
    void setLevel (short level, bool deferred);
    If deferred is set then this sets the ABR Stream Level for the next segment to be acquired. If it is not set, then the user agent must cancel the download of the current segment and the corresponding segment from the new level is to be acquired
  • Add:
    readonly attribute double currentSegmentDuration;
    Returns the duration of the current segment being downloaded (in terms of media time)
  • Add:
    readonly attribute double currentSegmentDownload;
    Returns the duration in seconds of the segment already downloaded (in terms of media time)
  • Add:
    readonly attribute double nextSegmentDuration;
    Returns the duration in seconds of the next segment to be downloaded (in terms of Media Time)
  • Add:
    readonly attribute long currentSegment;
    Returns the segment number of the segment currently being acquired. This is for algorithms that use absolute segment index as a factor in their switching decisions

For mode 3. the WHATWG has proposed some APIs here. The following alterations/ additions are suggested:

  • appendVideo should be asynchronous to allow a callback function to report when a segment has been acquired. This could also allow a segment to be refetched at a different level if need be (analogous to setLevel with deferred=false)
  • the currentSegmentDownload call from mode 2. should be available here too.