diff --git a/source b/source
index c3f6c4b981c..e541fc5ca1a 100644
--- a/source
+++ b/source
@@ -29457,7 +29457,6 @@ attribute, set the browsing context name of the element's nes
poster
preload
autoplay
mediagroup
loop
muted
controls
track
element. Sign-language tracks can be provided, again either embedded in the
- video stream or by synchronising multiple video
elements using the mediagroup
attribute or a MediaController
- object. Audio descriptions can be provided, either as a separate track embedded in the video
- stream, or a separate audio track in an audio
element slaved to the same controller as the video
element(s), or in text
- form using a WebVTT file referenced using the track
element and
- synthesized into speech by the user agent. WebVTT can also be used to provide chapter titles. For
- users who would rather not use a media element at all, transcripts or other textual alternatives
- can be provided by simply linking to them in the prose near the video
element.
track
element. Sign-language tracks can be embedded in the video stream. Audio
+ descriptions can be embedded in the video stream or in text form using a WebVTT file
+ referenced using the track
element and synthesized into speech by the user agent.
+ WebVTT can also be used to provide chapter titles. For users who would rather not use a media
+ element at all, transcripts or other textual alternatives can be provided by simply linking to
+ them in the prose near the video
element.
The video
element is a media element whose media data is
ostensibly video data, possibly with associated audio data.
The src
, preload
,
- autoplay
, mediagroup
, loop
, muted
, and controls
- attributes are the attributes common to all media
- elements.
autoplay
, loop
,
+ muted
, and controls
attributes are the attributes common to all media elements.
The poster
attribute gives the
URL of an image file that the user agent can show while no video data is available.
@@ -29831,7 +29825,6 @@ zero or more track
elements, then
crossorigin
preload
autoplay
mediagroup
loop
muted
controls
The src
, preload
,
- autoplay
, mediagroup
, loop
, muted
, and controls
- attributes are the attributes common to all media
- elements.
autoplay
, loop
,
+ muted
, and controls
attributes are the attributes common to all media elements.
The media element attributes, src
, crossorigin
, preload
, autoplay
,
- mediagroup
, loop
,
- muted
, and controls
, apply to all media
- elements. They are defined in this section.
loop
, muted
, and
+ controls
, apply to all media elements. They are defined in this section.
-
+ data-x="dom-media-HAVE_NOTHING">HAVE_NOTHING, then set it to that state.
If the paused
attribute is false, then set it to
true.
readyState
attribute to a new value.
-
-
Let jumped be false.
If either the media resource or the URL of the current media resource indicate a particular start time, then set the initial playback position to that time and, if jumped is still false, seek to that time and let jumped be - true.
+ data-x="dom-media-seek">seek to that time.For example, with media formats that support media fragment
syntax, the fragment can be used to
@@ -31578,22 +31560,6 @@ interface HTMLMediaElement : HTMLElement {
then select a video track. This will cause a change
event to be fired.
If the media element has a current media controller, then: - if jumped is true and the initial playback position, - relative to the current media controller's timeline, is greater than the - current media controller's media controller position, then - seek the media controller to the media element's initial - playback position, relative to the current media controller's timeline; - otherwise, seek the media element to the - media controller position, relative to the media element's - timeline.
Once the Can be set, to seek to the given time. Will throw an "readyState
attribute reaches HTMLMediaElement : HTMLElement {
InvalidStateError
" DOMException
if
- there is a current media controller.
All the media elements that share current - media controller use the same clock for their media timeline.
-Media elements have a current playback position, which must initially (i.e. in the absence of media data) be zero seconds. The current playback position is a time on the media timeline.
@@ -32071,9 +32031,7 @@ interface HTMLMediaElement : HTMLElement { getting, return the media element's default playback start position, unless that is zero, in which case it must return the element's official playback position. The returned value must be expressed in seconds. On setting, if the media - element has a current media controller, then the user agent must throw an - "InvalidStateError
" DOMException
; otherwise, if the
- media element's readyState
is 's readyState
is HAVE_NOTHING
, then it must set the media
element's default playback start position to the new value; otherwise, it must
set the official playback position to the new value and then HTMLMediaElement : HTMLElement {
attribute that, if specified, indicates that the media element is to seek back
to the start of the media resource upon reaching the end.
- The loop
attribute has no effect while the element has a
- current media controller.
-
The loop
IDL attribute must reflect
@@ -32258,9 +32213,9 @@ interface HTMLMediaElement : HTMLElement {
- The user agent estimates that data is being fetched at a rate where the current
- playback position, if it were to advance at the effective playback rate,
- would not overtake the available data before playback reaches the end of the media
- resource.
+ playback position, if it were to advance at the element's playbackRate
, would not overtake the available data
+ before playback reaches the end of the media resource.
- The user agent has entered a state where waiting longer will not result in further data
being obtained, and therefore nothing would be gained by delaying playback any further. (For
@@ -32419,10 +32374,6 @@ interface HTMLMediaElement : HTMLElement {
- If the media element has a current media controller, then
- report the controller state for the media element's current media
- controller.
-
@@ -32495,11 +32446,6 @@ interface HTMLMediaElement : HTMLElement {
mode, when they return to the normal playback mode, it is expected that the rate of playback
will be returned to the default rate of playback.
- When the element has a current media controller, the defaultPlaybackRate
attribute is ignored and the
- current media controller's defaultPlaybackRate
is used instead.
-
media . playbackRate
[ = value ]
@@ -32510,11 +32456,6 @@ interface HTMLMediaElement : HTMLElement {
Can be set, to change the rate of playback.
- When the element has a current media controller, the playbackRate
attribute is ignored and the current
- media controller's playbackRate
is
- used instead.
-
media . played
@@ -32561,10 +32502,8 @@ interface HTMLMediaElement : HTMLElement {
A media element is said to be potentially playing when its paused
attribute is false, the element has not ended
- playback, playback has not stopped due to errors, the element either has no
- current media controller or has a current media controller but is not
- blocked on its media controller, and the element is not a blocked media
- element.
+ playback, playback has not stopped due to errors, and the element is not a
+ blocked media element.
A waiting
DOM event can be fired as a result of an element that is
@@ -32590,9 +32529,8 @@ interface HTMLMediaElement : HTMLElement {
The direction of playback is forwards, and
- Either the media element does not have a loop
attribute specified, or the media element has
- a current media controller.
+ The media element does not have a loop
+ attribute specified.
@@ -32629,12 +32567,7 @@ interface HTMLMediaElement : HTMLElement {
data-x="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA
or HAVE_ENOUGH_DATA
and the user agent has reached a point
in the media resource where the user has to make a selection for the resource to
- continue. If the media element has a current media controller when this
- happens, then the user agent must report the controller state for the media
- element's current media controller. If the media element has a
- current media controller when the user makes a selection, allowing playback to
- resume, the user agent must similarly report the controller state for the media
- element's current media controller.
+ continue.
It is possible for a media element to have both ended playback and paused for user interaction at the same time.
@@ -32652,12 +32585,7 @@ interface HTMLMediaElement : HTMLElement { playback of the media resource in order to play content that is temporally anchored to the media resource and has a non-zero length, or to play content that is temporally anchored to a segment of the media resource but has a length longer than - that segment. If the media element has a current media controller when - this happens, then the user agent must report the controller state for the - media element's current media controller. If the media - element has a current media controller when the user agent unsuspends - playback, the user agent must similarly report the controller state for the - media element's current media controller. + that segment.One example of when a media element would be paused for
in-band content is when the user agent is playing HTMLMediaElement : HTMLElement {
If the media element has a
loop
- attribute specified and does not have a current media controller, then seek to the earliest possible position of the
- media resource and abort these steps.
As defined above, the ended
IDL attribute starts
returning true once the event loop returns to step 1.
Queue a task to fire a simple event named timeupdate
at the media element.
Queue a task that, if the media element does not have a
- current media controller, and the media element has still ended
+ Queue a task that, if the media element has still ended
playback, and the direction of playback is still forwards, and paused is false, changes paused to true and fires a
@@ -32699,10 +32625,6 @@ interface HTMLMediaElement : HTMLElement {
Queue a task to fire a simple event named If the media element has a current media controller, then
- report the controller state for the media element's current media
- controller. When the current playback position reaches the earliest possible
@@ -32726,14 +32648,13 @@ interface HTMLMediaElement : HTMLElement {
interface to the user. The When the The The If the playback has ended and the direction of
- playback is forwards, and the media element does not have a current
- media controller, seek to the earliest possible
- position of the media resource.ended
at the media element.playbackRate
attribute gives the
- effective playback rate (assuming there is no current media controller
- overriding it), which is the speed at which the media resource plays, as a multiple
- of its intrinsic speed. If it is not equal to the defaultPlaybackRate
, then the implication is that the
- user is using a feature such as fast forward or slow motion playback. The attribute is mutable: on
- getting it must return the last value it was set to, or 1.0 if it hasn't yet been set; on setting
- the attribute must be set to the new value, and the playback will change speed (if the element is
- potentially playing and there is no current media controller).defaultPlaybackRate
, then the implication is that
+ the user is using a feature such as fast forward or slow motion playback. The attribute is
+ mutable: on getting it must return the last value it was set to, or 1.0 if it hasn't yet been set;
+ on setting the attribute must be set to the new value, and the playback will change speed (if the
+ element is potentially playing).defaultPlaybackRate
or playbackRate
attributes change value (either by
@@ -32741,11 +32662,6 @@ interface HTMLMediaElement : HTMLElement {
control) the user agent must queue a task to fire a simple event named
ratechange
at the media element.defaultPlaybackRate
and
- playbackRate
attributes have no effect when the
- media element has a current media controller; the namesake attributes on
- the MediaController
object are used instead in that situation.
played
attribute must return a new static
@@ -32838,9 +32754,8 @@ interface HTMLMediaElement : HTMLElement {
This will cause the user agent to queue a
task to fire a simple event named HTMLMediaElement : HTMLElement {
If the media element has a current media controller, then - bring the media element up to speed with its new media controller.
-If the media element's paused
attribute is
@@ -32904,10 +32816,6 @@ interface HTMLMediaElement : HTMLElement {
Set the media element's autoplaying flag to false.
If the media element has a current media controller, then - report the controller state for the media element's current media - controller.
Return promise.
If the media element has a current media controller, then - report the controller state for the media element's current media - controller.
The effective playback rate is not necessarily the element's playbackRate
. When a media element has a
- current media controller, its effective playback rate is the
- MediaController
's media controller playback rate. Otherwise, the
- effective playback rate is just the element's playbackRate
. Thus, the current media
- controller overrides the media element.
If the effective playback rate is positive or zero, then the direction of - playback is forwards. Otherwise, it is backwards.
+If the element's playbackRate
is positive or zero,
+ then the direction of playback is forwards. Otherwise, it is backwards.
When a media element is potentially playing and
its Document
is a fully active Document
, its current
- playback position must increase monotonically at effective playback rate units
- of media time per unit time of the media timeline's clock. (This specification always
- refers to this as an increase, but that increase could actually be a decrease if
- the effective playback rate is negative.)
The effective playback rate can be 0.0, in which case the
- current playback position doesn't move, despite playback not being paused (paused
doesn't become true, and the must increase monotonically at the element's
playbackRate
units of media time per unit time of the
+ media timeline's clock. (This specification always refers to this as an
+ increase, but that increase could actually be a decrease if the element's playbackRate
is negative.)
The element's playbackRate
can be
+ 0.0, in which case the current playback position doesn't move, despite playback not
+ being paused (paused
doesn't become true, and the pause
event doesn't fire).
This specification doesn't define how the user agent achieves the appropriate @@ -33011,11 +32908,12 @@ interface HTMLMediaElement : HTMLElement { position.
While the direction of playback is backwards, any corresponding audio must be - muted. While the effective playback rate is - so low or so high that the user agent cannot play audio usefully, the corresponding audio must - also be muted. If the effective playback - rate is not 1.0, the user agent may apply pitch adjustments to the audio as necessary to - render it faithfully.
+ muted. While the element'splaybackRate
is so low or so high that the user agent
+ cannot play audio usefully, the corresponding audio must also be muted. If the element's playbackRate
is not 1.0, the user agent may apply pitch
+ adjustments to the audio as necessary to render it faithfully.
Media elements that are potentially playing
while not in a Document
must not play any video, but should play any
@@ -33024,9 +32922,8 @@ interface HTMLMediaElement : HTMLElement {
by that element may the element be garbage collected.
It is possible for an element to which no explicit references exist to play audio,
- even if such an element is not still actively playing: for instance, it could have a current
- media controller that still has references and can still be unpaused, or it could be
- unpaused but stalled waiting for content to buffer, or it could be still buffering, but with a
+ even if such an element is not still actively playing: for instance, it could be unpaused but
+ stalled waiting for content to buffer, or it could be still buffering, but with a
suspend
event listener that begins playback. Even a
media element whose media resource has no audio tracks could eventually play audio
again if it had an event listener that changes the media resource.
waiting
event will be
fired at the element.
-
This step sets the current playback position, and thus can
immediately trigger other conditions, such as the rules regarding when playback "HTMLMediaElement : HTMLElement {
Wait until the user agent has established whether or not the media data for
the new playback position is available, and, if it is, until it has decoded
- enough data to play back that position.
Await a stable state. The synchronous section consists of all the remaining steps of this algorithm. (Steps in the synchronous section are marked @@ -33435,9 +33328,7 @@ interface HTMLMediaElement : HTMLElement { interactive. Thus, a media element could play in a non-linear fashion. If this happens, the user agent must act as if the algorithm for seeking was used whenever the current playback position - changes in a discontinuous fashion (so that the relevant events fire). If the media - element has a current media controller, then the user agent must seek - the media controller appropriately instead.
+ changes in a discontinuous fashion (so that the relevant events fire).In this example, a script defines a function that takes a URL to a video and a reference to an - element where the video is to be placed. That function then tries to load the video, and, once it - is loaded, checks to see if there is a sign-language track available. If there is, it also - displays that track. Both tracks are just placed in the given container; it's assumed that styles - have been applied to make this work in a pretty way!
- -<script> - function loadVideo(url, container) { - var controller = new MediaController(); - var video = document.createElement('video'); - video.src = url; - video.autoplay = true; - video.controls = true; - video.controller = controller; - container.appendChild(video); - video.onloadedmetadata = function (event) { - for (var i = 0; i < video.videoTracks.length; i += 1) { - if (video.videoTracks[i].kind == 'sign') { - var sign = document.createElement('video'); - sign.src = url + '#track=' + video.videoTracks[i].id; - sign.autoplay = true; - sign.controller = controller; - container.appendChild(sign); - return; - } - } - }; - } -</script>- -
AudioTrackList
and VideoTrackList
objectsEach media element can have a MediaController
. A
- MediaController
is an object that coordinates the playback of multiple media elements, for instance so that a sign-language interpreter
- track can be overlaid on a video track, with the two being kept synchronised.
By default, a media element has no MediaController
. An implicit
- MediaController
can be assigned using the mediagroup
content attribute. An explicit
- MediaController
can be assigned directly using the controller
IDL attribute.
Media elements with a MediaController
are said
- to be slaved to their controller. The MediaController
modifies the playback
- rate and the playback volume of each of the media elements
- slaved to it, and ensures that when any of its slaved media
- elements unexpectedly stall, the others are stopped at the same time.
When a media element is slaved to a MediaController
, its playback
- rate is fixed to that of the other tracks in the same MediaController
, and any
- looping is disabled.
This feature has been implemented only in one user agent since it was introduced - in 2011. If a second implementation is not in progress by April 2016, it will be removed from - this specification. Please see issue #192 - for more details.
- -enum MediaControllerPlaybackState { "waiting", "playing", "ended" }; -[Constructor] -interface MediaController : EventTarget { - readonly attribute unsigned short readyState; // uses HTMLMediaElement.readyState's values - - readonly attribute TimeRanges buffered; - readonly attribute TimeRanges seekable; - readonly attribute unrestricted double duration; - attribute double currentTime; - - readonly attribute boolean paused; - readonly attribute MediaControllerPlaybackState playbackState; - readonly attribute TimeRanges played; - void pause(); - void unpause(); - void play(); // calls play() on all media elements as well - - attribute double defaultPlaybackRate; - attribute double playbackRate; - - attribute double volume; - attribute boolean muted; - - attribute EventHandler onemptied; - attribute EventHandler onloadedmetadata; - attribute EventHandler onloadeddata; - attribute EventHandler oncanplay; - attribute EventHandler oncanplaythrough; - attribute EventHandler onplaying; - attribute EventHandler onended; - attribute EventHandler onwaiting; - - attribute EventHandler ondurationchange; - attribute EventHandler ontimeupdate; - attribute EventHandler onplay; - attribute EventHandler onpause; - attribute EventHandler onratechange; - attribute EventHandler onvolumechange; -};- -
MediaController
()Returns a new MediaController
object.
controller
[ = controller ]Returns the current MediaController
for the media element, if any,
- or null otherwise.
Can be set, to set an explicit MediaController
. Doing so removes the mediagroup
attribute, if any.
readyState
Returns the state that the MediaController
was in the last time it fired events
- as a result of reporting the controller state.
- The values of this attribute are the same as for the readyState
attribute of media
- elements.
buffered
Returns a TimeRanges
object that represents the intersection of the time ranges
- for which the user agent has all relevant media data for all the slaved media elements.
seekable
Returns a TimeRanges
object that represents the intersection of the time ranges
- into which the user agent can seek for all the slaved media
- elements.
duration
Returns the difference between the earliest playable moment and the latest playable moment - (not considering whether the data in question is actually buffered or directly seekable, but not - including time in the future for infinite streams). Will return zero if there is no media.
- -currentTime
[ = value ]Returns the current playback position, in seconds, as a position between zero
- time and the current duration
.
Can be set, to seek to the given time.
- -paused
Returns true if playback is paused; false otherwise. When this attribute is true, any - media element slaved to this controller will be stopped.
- -playbackState
Returns the state that the MediaController
was in the last time it fired events
- as a result of reporting the controller state.
- The value of this attribute is either "playing
", indicating that the media is actively
- playing, "ended
", indicating that the media is
- not playing because playback has reached the end of all the slaved media elements,
- or "waiting
", indicating that the media is not
- playing for some other reason (e.g. the MediaController
is paused).
pause
()Sets the paused
attribute to true.
unpause
()Sets the paused
attribute to false.
play
()Sets the paused
attribute to false and
- invokes the play()
method of each slaved media element.
played
Returns a TimeRanges
object that represents the union of the time ranges in all
- the slaved media elements that have been played.
defaultPlaybackRate
[ = value ]Returns the default rate of playback.
- -Can be set, to change the default rate of playback.
- -This default rate has no direct effect on playback, but if the user switches to a
- fast-forward mode, when they return to the normal playback mode, it is expected that rate of
- playback (playbackRate
) will be returned
- to this default rate.
playbackRate
[ = value ]Returns the current rate of playback.
- -Can be set, to change the rate of playback.
- -volume
[ = value ]Returns the current playback volume multiplier, as a number in the range 0.0 to 1.0, where - 0.0 is the quietest and 1.0 the loudest.
- -Can be set, to change the volume multiplier.
- -Throws an "IndexSizeError
" DOMException
if the new value is not in the
- range 0.0 .. 1.0.
muted
[ = value ]Returns true if all audio is muted (regardless of other attributes either on the controller - or on any media elements slaved to this controller), and - false otherwise.
- -Can be set, to change whether the audio is muted or not.
- -A media element can have a current media controller, which is a
- MediaController
object. When a media element is created without a mediagroup
attribute, it does not have a current media
- controller. (If it is created with such an attribute, then that attribute
- initialises the current media controller, as defined below.)
The slaved media elements of a MediaController
are the media elements whose current media controller is that
- MediaController
. All the slaved media elements of a
- MediaController
must use the same clock for their definition of their media
- timeline's unit time. When the user agent is required to act on each slaved media element in turn, they must be processed in the order that they
- were last associated with the MediaController
.
The controller
attribute on a media
- element, on getting, must return the element's current media controller, if
- any, or null otherwise. On setting, the user agent must run the following steps:
Let m be the media element in question.
Let old controller be m's current media - controller, if it currently has one, and null otherwise.
Let new controller be null.
Let m have no current media controller, if it currently - has one.
Remove the element's mediagroup
content
- attribute, if any.
If the new value is null, then jump to the update controllers step below.
Let m's current media controller be the new - value.
Let new controller be m's current media - controller.
Bring the media element up to speed with its new media controller.
Update controllers: If old controller and new - controller are the same (whether both null or both the same controller) then abort these - steps.
If old controller is not null and still has one or more slaved - media elements, then report the controller state for old - controller.
If new controller is not null, then report the controller - state for new controller.
The MediaController()
constructor, when
- invoked, must return a newly created MediaController
object.
The readyState
attribute must
- return the value to which it was most recently set. When the MediaController
object
- is created, the attribute must be set to the value 0 (HAVE_NOTHING
). The value is updated by the report the
- controller state algorithm below.
The seekable
attribute must return
- a new static normalised TimeRanges
object that represents the
- intersection of the ranges of the media resources of the
- slaved media elements that the user agent is able to seek to, at the time the
- attribute is evaluated.
The buffered
attribute must return
- a new static normalised TimeRanges
object that represents the
- intersection of the ranges of the media resources of the
- slaved media elements that the user agent has buffered, at the time the attribute is
- evaluated. Users agents must accurately determine the ranges available, even for media streams
- where this can only be determined by tedious inspection.
The duration
attribute must return
- the media controller duration.
Every 15 to 250ms, or whenever the MediaController
's media controller
- duration changes, whichever happens least often, the user agent must queue a
- task to fire a simple event named durationchange
at the
- MediaController
. If the MediaController
's media controller
- duration decreases such that the media controller position is greater than the
- media controller duration, the user agent must immediately seek the media
- controller to media controller duration.
The currentTime
attribute must
- return the media controller position on getting, and on setting must seek the
- media controller to the new value.
Every 15 to 250ms, or whenever the MediaController
's media controller
- position changes, whichever happens least often, the user agent must queue a
- task to fire a simple event named timeupdate
at the
- MediaController
.
When a MediaController
is created it is a playing media controller. It
- can be changed into a paused media controller and back either via the user agent's user
- interface (when the element is exposing a user
- interface to the user) or by script using the APIs defined in this section (see below).
The paused
attribute must return
- true if the MediaController
object is a paused media controller, and
- false otherwise.
When the pause()
method is invoked,
- if the MediaController
is a playing media controller then the user agent
- must change the MediaController
into a paused media controller,
- queue a task to fire a simple event named pause
at the MediaController
, and then
- report the controller state of the MediaController
.
When the unpause()
method is
- invoked, if the MediaController
is a paused media controller, the user
- agent must change the MediaController
into a playing media controller,
- queue a task to fire a simple event named play
at the MediaController
, and then
- report the controller state of the MediaController
.
When the play()
method is invoked, the
- user agent must invoke the play()
method of each slaved media element in turn, and then invoke the unpause
method of the MediaController
.
The playbackState
attribute
- must return the value to which it was most recently set. When the MediaController
- object is created, the attribute must be set to the value "waiting
". The value is updated by the report the
- controller state algorithm below.
The played
attribute must return a
- new static normalised TimeRanges
object that represents the union of the
- ranges of points on the media timelines of the media resources of the slaved media elements that the
- user agent has so far reached through the usual monotonic increase of their current playback positions during normal playback, at the time the
- attribute is evaluated.
A MediaController
has a media controller default playback rate and a
- media controller playback rate, which must both be set to 1.0 when the
- MediaController
object is created.
The defaultPlaybackRate
- attribute, on getting, must return the MediaController
's media controller
- default playback rate, and on setting, must set the MediaController
's
- media controller default playback rate to the new value, then queue a
- task to fire a simple event named ratechange
at the
- MediaController
.
The playbackRate
attribute, on
- getting, must return the MediaController
's media controller playback
- rate, and on setting, must set the MediaController
's media controller
- playback rate to the new value, then queue a task to fire a simple
- event named ratechange
at the
- MediaController
.
A MediaController
has a media controller volume multiplier, which must
- be set to 1.0 when the MediaController
object is created, and a media controller
- mute override, much must initially be false.
The volume
attribute, on getting,
- must return the MediaController
's media controller volume multiplier,
- and on setting, if the new value is in the range 0.0 to 1.0 inclusive, must set the
- MediaController
's media controller volume multiplier to the new value
- and queue a task to fire a simple event named volumechange
at the
- MediaController
. If the new value is outside the range 0.0 to 1.0 inclusive, then, on
- setting, an "IndexSizeError
" DOMException
must be thrown
- instead.
The muted
attribute, on getting, must
- return the MediaController
's media controller mute override, and on
- setting, must set the MediaController
's media controller mute override
- to the new value and queue a task to fire a simple event named volumechange
at the
- MediaController
.
The media resources of all the slaved media
- elements of a MediaController
have a defined temporal relationship which
- provides relative offsets between the zero time of each such media resource: for
- media resources with a timeline offset, their
- relative offsets are the difference between their timeline offset; the zero times of
- all the media resources without a timeline offset
- are not offset from each other (i.e. the origins of their timelines are cotemporal); and finally,
- the zero time of the media resource with the earliest timeline offset
- (if any) is not offset from the zero times of the media
- resources without a timeline offset (i.e. the origins of media resources without a timeline offset are further cotemporal
- with the earliest defined point on the timeline of the media resource with the
- earliest timeline offset).
The media resource end position of a media resource in a media - element is defined as follows: if the media resource has a finite and known - duration, the media resource end position is the duration of the media - resource's timeline (the last defined position on that timeline); otherwise, the - media resource's duration is infinite or unknown, and the media resource end - position is the time of the last frame of media data currently available for - that media resource.
- -Each MediaController
also has its own defined timeline. On this timeline, all the
- media resources of all the slaved media elements
- of the MediaController
are temporally aligned according to their defined offsets. The
- media controller duration of that MediaController
is the time from the
- earliest earliest possible position, relative to this MediaController
- timeline, of any of the media resources of the slaved
- media elements of the MediaController
, to the time of the latest media
- resource end position of the media resources of the
- slaved media elements of the MediaController
, again relative to this
- MediaController
timeline.
Each MediaController
has a media controller position. This is the time
- on the MediaController
's timeline at which the user agent is trying to play the
- slaved media elements. When a MediaController
is created, its
- media controller position is initially zero.
When the user agent is to bring a media element up to speed with its new media controller, it must seek that media element to the
- MediaController
's media controller position relative to the media
- element's timeline.
When the user agent is to seek the media controller to a particular new playback position, it must follow these steps:
- -If the new playback position is less than zero, then set it to - zero.
If the new playback position is greater than the media - controller duration, then set it to the media controller duration.
Set the media controller position to the new playback - position.
Seek each slaved - media element to the new playback position relative to the media - element timeline.
A MediaController
is a blocked media controller if the
- MediaController
is a paused media controller, or if any of its
- slaved media elements are blocked media
- elements, or if any of its slaved media elements whose autoplaying
- flag is true still have their paused
attribute set to
- true, or if all of its slaved media elements have their paused
attribute set to true.
A media element is blocked on its media controller if the
- MediaController
is a blocked media controller, or if its media
- controller position is either before the media resource's earliest
- possible position relative to the MediaController
's timeline or after the end
- of the media resource relative to the MediaController
's timeline.
When a MediaController
is not a blocked media
- controller and it has at least one slaved media
- element whose Document
is a fully active Document
,
- the MediaController
's media controller position must increase
- monotonically at media controller playback rate units of time on the
- MediaController
's timeline per unit time of the clock used by its slaved media
- elements.
When the zero point on the timeline of a MediaController
moves relative to the
- timelines of the slaved media elements by a time difference ΔT, the MediaController
's media controller
- position must be decremented by ΔT.
In some situations, e.g. when playing back a live stream without buffering - anything, the media controller position would increase monotonically as described - above at the same rate as the ΔT described in the previous paragraph - decreases it, with the end result that for all intents and purposes, the media controller - position would appear to remain constant (probably with the value 0).
- -A MediaController
has a most recently reported readiness state, which
- is a number from 0 to 4 derived from the numbers used for the media element readyState
attribute, and a most recently reported
- playback state, which is either playing, waiting, or ended.
When a MediaController
is created, its most recently reported readiness
- state must be set to 0, and its most recently reported playback state must be
- set to waiting.
When a user agent is required to report the controller state for a
- MediaController
, the user agent must run the following steps:
If the MediaController
has no slaved media elements, let new readiness state be 0.
Otherwise, let it have the lowest value of the readyState
IDL attributes of all of its slaved media
- elements.
If the MediaController
's most recently reported readiness state is
- less than the new readiness state, then run these substeps:
Let next state be the MediaController
's most
- recently reported readiness state.
Loop: Increment next state by one.
Queue a task to run the following steps:
- -Set the MediaController
's readyState
attribute to the value next state.
Fire a simple event at the MediaController
object, whose
- name is the event name corresponding to the value of next state given in
- the table below.
If next state is less than new readiness state, - then return to the step labeled loop.
Otherwise, if the MediaController
's most recently reported readiness
- state is greater than new readiness state then queue a
- task to fire a simple event at the MediaController
object,
- whose name is the event name corresponding to the value of new readiness
- state given in the table below.
Value of new readiness state - | Event name - - |
---|---|
0 - | emptied
-
- |
1 - | loadedmetadata
-
- |
2 - | loadeddata
-
- |
3 - | canplay
-
- |
4 - | canplaythrough
-
- |
Let the MediaController
's most recently reported readiness state
- be new readiness state.
Initialise new playback state by setting it to the state given for the - first matching condition from the following list:
- -MediaController
has no slaved media elementsMediaController
's slaved media elements have
- ended playback and the media controller playback rate is positive or
- zeroMediaController
is a blocked media controllerIf the MediaController
's most recently reported playback state
- is not equal to new playback state and the new playback
- state is ended, then queue a task that, if the
- MediaController
object is a playing media controller, and all of the
- MediaController
's slaved media elements have still ended
- playback, and the media controller playback rate is still positive or zero,
- changes the MediaController
object to a paused media controller and
- then fires a simple event named pause
at the MediaController
- object.
If the MediaController
's most recently reported playback state is
- not equal to new playback state then queue a task to run the
- following steps:
Set the MediaController
's playbackState
attribute to the value given in
- the second column of the row of the following table whose first column contains the new playback state.
Fire a simple event at the MediaController
object, whose name
- is the value given in the third column of the row of the following table whose first column
- contains the new playback state.
New playback state - | New value for playbackState
- | Event name - |
---|---|---|
playing - | "playing "
- | playing
- |
waiting - | "waiting "
- | waiting
- |
ended - | "ended "
- | ended
- |
Let the MediaController
's most recently reported playback state
- be new playback state.
The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes,
- by all objects implementing the MediaController
interface:
Event handler | Event handler event type - |
---|---|
onemptied | emptied
- |
onloadedmetadata | loadedmetadata
- |
onloadeddata | loadeddata
- |
oncanplay | canplay
- |
oncanplaythrough | canplaythrough
- |
onplaying | playing
- |
onended | ended
- |
onwaiting | waiting
- |
ondurationchange | durationchange
- |
ontimeupdate | timeupdate
- |
onplay | play
- |
onpause | pause
- |
onratechange | ratechange
- |
onvolumechange | volumechange
- |
The task source for the tasks listed in this - section is the DOM manipulation task source.
- -The mediagroup
content attribute on media elements can be used to link multiple media elements together by implicitly creating a MediaController
. The
- value is text; media elements with the same value are
- automatically linked by the user agent.
When a media element is created with a mediagroup
attribute, and when a media element's
- mediagroup
attribute is set, changed, or removed, the
- user agent must run the following steps:
Let m be the media element in question.
Let old controller be m's current media - controller, if it currently has one, and null otherwise.
Let new controller be null.
Let m have no current media controller, if it currently - has one.
If m's mediagroup
attribute
- is being removed, then jump to the update controllers step below.
If there is another media element whose Document
is the same as
- m's node document (even if one or both of these elements are not
- actually in the Document
), and which
- also has a mediagroup
attribute, and whose mediagroup
attribute has the same value as the new value of
- m's mediagroup
attribute, then
- let controller be that media element's current media
- controller.
Otherwise, let controller be a newly created
- MediaController
.
Let m's current media controller be controller.
Let new controller be m's current media - controller.
Bring the media element up to speed with its new media - controller.
Update controllers: If old - controller and new controller are the - same (whether both null or both the same controller) then abort - these steps.
If old controller is not null and still has one or more slaved - media elements, then report the controller state for old - controller.
If new controller is not null, then report the controller - state for new controller.
The mediaGroup
IDL attribute on media elements must reflect the mediagroup
content attribute.
Multiple media elements referencing the same media
- resource will share a single network request. This can be used to efficiently play two
- (video) tracks from the same media resource in two different places on the screen.
- Used with the mediagroup
attribute, these elements can
- also be kept synchronised.
In this example, a sign-language interpreter track from a movie file is overlaid on the primary
- video track of that same video file using two video
elements, some CSS, and an
- implicit MediaController
:
<article> - <style scoped> - div { margin: 1em auto; position: relative; width: 400px; height: 300px; } - video { position; absolute; bottom: 0; right: 0; } - video:first-child { width: 100%; height: 100%; } - video:last-child { width: 30%; } - </style> - <div> - <video src="movie.vid#track=Video&track=English" autoplay controls mediagroup=movie></video> - <video src="movie.vid#track=sign" autoplay mediagroup=movie></video> - </div> -</article>- -
If the media element has a current media controller, then the user
- agent should expose audio tracks from all the slaved media elements (although
- avoiding duplicates if the same media resource is being used several times). If a
- media resource's audio track exposed in this way has no known name, and it is the
- only audio track for a particular media element, the user agent should use the
- element's title
attribute, if any, as the name (or as part of the
- name) of that track.
Even when the attribute is absent, however, user agents may provide controls to affect playback of the media resource (e.g. play, pause, seeking, track selection, and volume controls), but such features should not interfere with the page's normal rendering. For example, such features could @@ -36637,35 +35566,15 @@ red:89 interface features exposed by the user agent must be implemented in terms of the DOM API described above, so that, e.g., all the same events fire.
-When a media element has a current media controller, the user agent's
- user interface for pausing and unpausing playback, for seeking, for changing the rate of playback,
- for fast-forwarding or rewinding, and for muting or changing the volume of audio of the entire
- group must be implemented in terms of the MediaController
API exposed on that
- current media controller. When a media element has a current media
- controller, and all the slaved media elements of that
- MediaController
are paused, the user agent should also unpause all the slaved
- media elements when the user invokes a user agent interface control for beginning
- playback.
Features such as fast-forward or rewind must be implemented by only changing the playbackRate
attribute (and not the defaultPlaybackRate
- attribute). Again, when a media element has a current media controller,
- the attributes with those names on that MediaController
object must be used;
- otherwise, the attributes with those names on the media element itself must be used.
When a media element has a current media controller, seeking must be
- implemented in terms of the currentTime
- attribute on that MediaController
object. Otherwise, the user agent must directly
- seek to the requested position in the media
- element's media timeline. For media resources where seeking to an arbitrary
- position would be slow, user agents are encouraged to use the approximate-for-speed flag
- when seeking in response to the user manipulating an approximate position interface such as a seek
- bar.
When a media element has a current media controller, user agents may
- additionally provide the user with controls that directly manipulate an individual media
- element without affecting the MediaController
, but such features are
- considered relatively advanced and unlikely to be useful to most users.
Seeking must be implemented in terms of seeking to the + requested position in the media element's media timeline. For media + resources where seeking to an arbitrary position would be slow, user agents are encouraged to use + the approximate-for-speed flag when seeking in response to the user manipulating an + approximate position interface such as a seek bar.
For the purposes of listing chapters in the media resource, only text tracks in the media element's list of text tracks @@ -36756,18 +35665,10 @@ red:89
If the element's audio output is muted, the element's effective media volume is zero. Abort these steps.
If the element has a current media controller and that
- MediaController
object's media controller mute override is true, the
- element's effective media volume is zero. Abort these steps.
Let volume be the playback volume of the audio portions of the media element, in range 0.0 (silent) to 1.0 (loudest).
If the element has a current media controller, multiply volume by that MediaController
object's media controller
- volume multiplier. (The media controller volume multiplier is in the range
- 0.0 to 1.0, so this can only reduce the value.)
The element's effective media volume is volume,
interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest
setting, values in between increasing in loudness. The range need not be linear. The loudest
@@ -37107,11 +36008,7 @@ dictionary TrackEventInit : EventInit {
data-x="dom-media-readyState">readyState is equal to or greater than HAVE_FUTURE_DATA
. Even if this event fires, the
element might still not be potentially playing, e.g. if the element is
- blocked on its media controller (e.g. because the current media
- controller is paused, or another slaved media
- element is stalled somehow, or because the media resource has no data
- corresponding to the media controller position), or the element is paused
- for user interaction or paused for in-band content.
+ paused for user interaction or paused for in-band content.
paused
being false, but those reasons do not fire this event
(and when those situations resolve, a separate playing
- event is not fired either): e.g. the element is newly blocked on its media
- controller, or playback ended, or playback
- stopped due to errors, or the element has paused for user interaction
- or paused for in-band content.
+ event is not fired either): e.g., playback has ended, or
+ playback stopped due to errors, or the element has paused for user
+ interaction or paused for in-band content.
The following events fire on MediaController
objects:
Event name - - | Interface - - | Fired when... - - |
---|---|---|
emptied
-
- | Event
-
- | All the slaved media elements newly have readyState set to HAVE_NOTHING or greater, or there are no longer any
- slaved media elements.
-
- |
loadedmetadata
-
- | Event
-
- | All the slaved media elements newly have readyState set to HAVE_METADATA or greater.
-
- |
loadeddata
-
- | Event
-
- | All the slaved media elements newly have readyState set to HAVE_CURRENT_DATA or greater.
-
- |
canplay
-
- | Event
-
- | All the slaved media elements newly have readyState set to HAVE_FUTURE_DATA or greater.
-
- |
canplaythrough
-
- | Event
-
- | All the slaved media elements newly have readyState set to HAVE_ENOUGH_DATA .
-
- |
playing
-
- | Event
-
- | The MediaController is no longer a blocked media controller.
-
- |
waiting
-
- | Event
-
- | The MediaController is now a blocked media controller.
-
- |
ended
-
- | Event
-
- | All the slaved media elements have newly ended playback; the
- MediaController has reached the end of all the slaved media elements.
-
- |
durationchange
-
- | Event
-
- | The duration attribute has just been
- updated.
-
- |
timeupdate
-
- | Event
-
- | The media controller position changed. - - |
play
-
- | Event
-
- | The paused attribute is newly false.
-
- |
pause
-
- | Event
-
- | The paused attribute is newly true.
-
- |
ratechange
-
- | Event
-
- | Either the defaultPlaybackRate
- attribute or the playbackRate attribute
- has just been updated.
-
- |
volumechange
-
- | Event
-
- | Either the volume attribute or the muted attribute has just been updated.
-
- |
The following events fire on AudioTrackList
, VideoTrackList
, and
TextTrackList
objects:
When multiple tracks are synchronised with a MediaController
, it is possible for
- scripts to add and remove media elements from the MediaController
's list of
- slaved media elements, even while these tracks are playing. How smoothly the media
- plays back in such situations is another quality-of-implementation issue.
When a media element that is paused is crossorigin;
preload
;
autoplay
;
- mediagroup
;
loop
;
muted
;
controls
@@ -116249,7 +114993,6 @@ interface External {
poster
;
preload
;
autoplay
;
- mediagroup
;
loop
;
muted
;
controls
;
@@ -117210,12 +115953,6 @@ interface External {
style
mediagroup
- audio
;
- video
- MediaController
- menu
button