diff --git a/source b/source index 3366fe26248..c9da2cc45ed 100644 --- a/source +++ b/source @@ -2496,6 +2496,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • CORS protocol
  • default `User-Agent` value
  • extract a MIME type
  • +
  • extract header list values
  • fetch
  • HTTP-redirect fetch
  • ok status
  • @@ -2563,6 +2564,16 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • parser metadata
  • reload-navigation flag
  • history-navigation flag
  • +
  • add a range header algorithm
  • + + +
  • + header list and its + associated: +
  • @@ -32818,6 +32829,25 @@ interface HTMLMediaElement : HTMLElement {

    +

    A media resource has a uses rewritten requests flag, which is + initially unset.

    + +

    The uses rewritten + requests flag is used to track media resources that use responses that didn't + originate from their request URL, which is possible via a service worker. The aim is to prevent + developers from mixing CORS-cross-origin responses from different sources in a way + that could expose data through the media's duration, width, or height.

    + +

    A media resource has a uses opaque response flag, which + is initially unset.

    + +

    The uses opaque + response flag affects whether subtitles referenced in the media data are + exposed in the API and, for video elements, whether a canvas gets + tainted when the video is drawn on it.

    +

    A media resource can have multiple audio and video tracks. For the purposes of a media element, the video data of the media resource is only that of the currently selected track (if any) as given by the element's MediaError {

    Fetch request. -

    The response's unsafe response obtained in this fashion, if any, - contains the media data. It can be CORS-same-origin or - CORS-cross-origin; this affects whether subtitles referenced in the media - data are exposed in the API and, for video elements, whether a - canvas gets tainted when the video is drawn on it.

    +

    Let responseUrlList be response's url list

    + +

    If responseUrlList[0] does not exist, or + responseUrlList[0] does not equal request's url, set current media resource's uses rewritten requests flag.

    + +

    We test the first entry of the url + list since that reveals if the service worker "rewrote" the request to another URL.

    + +

    If the response is CORS-cross-origin, set the current media + resource's uses opaque + response flag.

    The stall timeout is an implementation-defined length of time, which should be about three seconds. When a media element that is actively @@ -33754,11 +33793,17 @@ interface MediaError { element's delaying-the-load-event flag to false. This stops delaying the load event.

    -

    The user agent may use whatever means necessary to fetch the resource (within the constraints - put forward by this and other specifications); for example, reconnecting to the server in the - face of network errors, using HTTP range retrieval requests, or switching to a streaming - protocol. The user agent must consider a resource erroneous only if it has given up trying to - fetch it.

    +

    The user agent may go on to use whatever means necessary to fetch the resource (within + the constraints put forward by this and other specifications); for example, reconnecting to + the server in the face of network errors, or switching to a streaming protocol. The user + agent must consider a resource erroneous only if it has given up trying to fetch it.

    + +

    The user agent may use the ranged fetch + steps to perform HTTP range retrieval requests for a given start and (optional) end + range. Through its knowledge of container formats, the user agent may issue a ranged request + to gather metadata it knows to be at the end of the resource. Or, if the media is seeked, + the browser may use metadata to convert a temporal range to a byte range and make a ranged + request.

    To determine the format of the media resource, the user agent must use the rules for sniffing audio and video specifically.

    @@ -33792,6 +33837,93 @@ interface MediaError { in this situation, once playback has ended, the user agent will end up firing a suspend event, as described earlier.

    + +

    The ranged fetch steps with a + start and optional end are the following steps:

    + +
      +
    1. Let request be the result of creating a potential-CORS request given + URL record, "media", and the crossorigin attribute + value.

    2. + +
    3. Set request's client to the + media element's node document's Window object's + environment settings object

    4. + +
    5. Set request's type to "audio" if the media element is an audio element + and to "video" otherwise.

    6. + +
    7. Add a range header to + request with start and if provided, end. + +

    8. Fetch request.

    9. + +
    10. If the response is a network error, return + response.

    11. + +
    12. Let requestRewritten be false.

    13. + +
    14. Let responseUrlList be response's url list

    15. + +
    16. If responseUrlList[0] does not exist, or responseUrlList[0] does not equal + request's url, set + requestRewritten to true

    17. + +
    18. +

      If the response is CORS-cross-origin, or the current + media resource's uses opaque response + flag is set, then:

      + +
        +
      1. If requestRewritten is true, or current media resource's + uses rewritten requests + flag is set, then return a network error.

      2. +
      +
    19. + +
    20. If response's status is + not 200 or 206, return a network + error.

    21. + +
    22. +

      If response's status is + 206, then:

      + +
        +
      1. Let range be the result of extracting `Content-Range` from response's header list.

      2. + +
      3. If range's first-byte-pos + doesn't equal start, return a network error.

      4. +
      +
    23. + +
    24. If requestRewritten is true, set current media resource's + uses rewritten requests + flag.

    25. + +
    26. If the response is CORS-cross-origin, set the current + media resource's uses opaque data flag.

    27. + +
    28. +

      Return response.

      + +

      How the browser consumes responses for various media types isn't covered + by this spec. However, the browser is encouraged to accept an HTTP 200 response even if + it requested a range. It could terminate fetches that are (or become) redundant, e.g. if + the returned range is already covered by a previous or in-flight response, or the media + is seeked as such that active fetches are unlikely to be useful.

      +
    29. +