MediaStream and HTMLMediaElement

Hi

I've done some investigating. My initial thought is that this will 
require some more work.

/Adam

=================

# srcObject attribute description in the Media Capture and Streams spec

"This attribute overrides both the src attribute and any <source> 
elements. Specifically, if srcObject is specified, the User Agent MUST 
use it as the source of media, even if the src attribute is also set or 
<source> children are present."

Comment: Covered.

"If the value of srcObject is replaced or set to null the User Agent 
MUST re-run the media element load algorithm"

Comment: Covered

# Modifications/restrictions mentioned in the Media Capture and Streams 
spec:

"Whenever the User Agent runs the media element load algorithm, if 
srcObject is specified, the User Agent must immediately go to the 
resource fetch phase of the algorithm."

Comment: The HTML5.1 document simply says that the "media element load 
algorithm" should be run when the srcObject is set. This will be a 
change in behavior since step 3 (of the "media element load algorithm") 
will fire an "abort" event (networkState is always NETWORK_IDLE). Step 4 
will queue a task that fires an additional event ("emptied") (also 
because of the network state). One way to avoid these events would be to 
force the NETWORK_EMPTY state ahead of running the "media element load 
algorithm". The state would be set back to NETWORK_IDLE later in the 
"resource fetch algorithm".

"Whenever the User Agent runs the media element load algorithm, and 
reaches the resource fetch phase of this algorithm, if it determines 
that the media resource in question is a MediaStream, it MUST 
immediately abort the resource selection algorithm, and set the 
media.readyState to HAVE_NOTHING if the MediaStream is inactive, or 
HAVE_ENOUGH_DATA if it is active."

Comment: The HTML5.1 document doesn't prevent the "resource selection 
algorithm" from running for srcObject=MediaStream. Instead, the 
algorithm has a special mode (mode=object) if the element has an 
"assigned media provider object". The "resource selection algorithm" 
also updates the networkState to values not supported by the attribute 
table in the MediaCap spec (NETWORK_NO_SOURCE and NETWORK_LOADING).

"Let the media resource, represented by the MediaStream object, indicate 
to the media element load algorithm that all audio tracks and all live 
video tracks (represented by a MediaStreamTrack with the readyState 
attribute set to live) should be enabled. This allows the media element 
load algorithm to set AudioTrack.enabled, VideoTrack.selected and 
VideoTrackList.selectedIndex accordingly."

Comment: Covered ("if the user agent has information that would 
facilitate the selection of specific audio tracks to improve the user's 
experience")

"If a MediaStreamTrack is removed from a MediaStream, played by a media 
element, the corresponding AudioTrack or VideoTrack MUST be removed as 
well."

Comment: Not covered (at least directly).

"The User Agent MUST NOT buffer data from a MediaStream. When playing, 
the User Agent MUST always play the current data from the stream."

Comment: Not covered (at least directly).

"When the MediaStream state moves from the active to the inactive state, 
the User Agent MUST raise an ended event on the media element and set 
its ended attribute to true. Note that once ended equals true the media 
element will not play media even if new Tracks are added to the 
MediaStream (causing it to return to the active state) unless autoplay 
is true or the JavaScript restarts the element, e.g., by calling play()."

Comment: Not covered (at least directly).

Received on Thursday, 11 June 2015 08:37:05 UTC