Re: MediaStream Constructor

On 06/14/2012 10:52 AM, Adam Bergkvist wrote:
> On 2012-05-15 19:40, Anant Narayanan wrote:
>> On 05/15/2012 06:47 AM, Rich Tibbett wrote:
>>> Anant Narayanan wrote:
>>>>> On 2012-05-10 13:32, Rich Tibbett wrote:
>>>>
>>>>>> We could certainly tighten up the definition of the
>>>>>> MediaStreamTrackList
>>>>>> collection interface and I would be happy to take an action to propose
>>>>>> some text here.
>>>>
>>>> Sounds great, thanks Rich!
>>>
>>> What would be the best way to do this? Plain text in an email, forking
>>> the spec to add the proposal in ReSpec markup so it can be copied
>>> verbatim in to the spec on approval or adding and committing the updates
>>> directly to the spec in the version control system?
>>
>> All of the above! Use any mechanism you are comfortable with and I'll
>> make sure the text ends up in the right place.
>
> I was going to propose some changes to the MediaStream() constructor
> algorithm, but I think it would be best to move to the new argument list
> before.
>
> What's the status on this Rich? I can write something up if you feel
> that you don't have the time.
>

Here's text for the MediaStream() constructor that lets the developer 
pass a list of MediaStream, MediaStreamTrackList and MediaStreamTrack as 
argument. The algorithm also clarifies that the tracks in the new stream 
are new instances.

If we want to proceed with it I can push it from my local repo. We might 
want to add text about what happens when ended tracks/streams are passed 
in as arguments.

/Adam

-------

The MediaStream() constructor takes zero or one argument. If the 
argument, trackContainers, is supplied, it specifies a list of 
MediaStream, MediaStreamTrackList and MediaStreamTrack objects. The list 
objects specifies existing tracks whose sources will be used to constuct 
the tracks in the new MediaStream object. A MediaStreamTrack object 
specifies a track directly, while MediaStream and MediaStreamTrackList 
objects specifiy all tracks contained within these objects. When the 
constructor is invoked, the UA must run the following steps:

     1. Let trackContainers be the constructor’s argument, if any, or 
null otherwise.

     2. Let stream be a newly constructed MediaStream object.

     3. Set stream’s label attribute to a newly generated value.

     4. If trackContainers is not null, then run the following sub steps 
for every element, trackContainer, in trackContainers:

         1. If trackContainer is null, then abort these steps and 
continue with the next element.

         2. If trackContainer is of type MediaStreamTrack, then run the 
following sub steps:

             1. Add track: Let track be the MediaStreamTrack about to be 
processed.

             2. If track’s kind attribute is not "audio" or "video", 
then throw a SyntaxError exception.

             3. If there is a MediaStreamTrack contained within stream 
that has the same underlying source as track, then abort these steps.

             4. Create a new MediaStreamTrack object and let it inherit 
track’s underlying source, kind, label and enabled attributes. Add the 
new MediaStreamTrack to the corresponding track list (audioTracks or 
videoTracks) in stream according to kind.

         3. If trackContainer is of type MediaStreamTrackList, then run 
the sub steps labeled Add track (above) for every MediaStreamTrack in 
trackContainer.

         4. If trackContainer is of type MediaStream, then run the sub 
steps labeled Add track (above) for every MediaStreamTrack in 
trackContainer’s two track lists (audioTracks and videoTracks).

     5. Return stream.

Received on Monday, 9 July 2012 13:35:26 UTC