From dc83dded06828525fcbfaf455792f537c52eed95 Mon Sep 17 00:00:00 2001
From: Jake Archibald User-Agent
` value
+
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 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 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.MediaError {
video
elements, whether a
- canvas
gets tainted when the video is drawn on it.suspend
event, as described
earlier.
The ranged fetch steps with a + start and optional end are the following steps:
+ +Let request be the result of creating a potential-CORS request given
+ URL record, "media
", and the crossorigin attribute
+ value.
Set request's client to the
+ media element's node document's Window
object's
+ environment settings object
Set request's type to "audio
" if the media element is an audio
element
+ and to "video
" otherwise.
Add a range header to + request with start and if provided, end. + +
Fetch request.
If the response is a network error, return + response.
Let requestRewritten be false.
Let responseUrlList be response's url list
If responseUrlList[0] does not exist, or responseUrlList[0] does not equal + request's url, set + requestRewritten to true
If the response is CORS-cross-origin, or the current + media resource's uses opaque response + flag is set, then:
+ +If requestRewritten is true, or current media resource's + uses rewritten requests + flag is set, then return a network error.
If response's status is
+ not 200
or 206
, return a network
+ error.
If response's status is
+ 206
, then:
Let range be the result of extracting `Content-Range
` from response's header list.
If range's first-byte-pos + doesn't equal start, return a network error.
If requestRewritten is true, set current media resource's + uses rewritten requests + flag.
If the response is CORS-cross-origin, set the current + media resource's uses opaque data flag.
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.
+