[mediacapture-main] "tracks" is undefined if the constructor's argument is not present

jianjunz has just created a new issue for https://github.com/w3c/mediacapture-main:

== "tracks" is undefined if the constructor's argument is not present ==
For `MediaStream` construction algorithm described in [section 4.2](https://w3c.github.io/mediacapture-main/#mediastream), when construct a `MediaStream` without argument, `tracks` in step 4 will be `undefined`. I think it does not make sense to iterate over an undefined object. So how about combining step 3 and 4 as a sub algorithm like this
```
3. If the constructor's argument is present, run the following steps:  
  1. Construct a set of tracks, tracks based on the type of argument:
    • A MediaStream object:
      Let tracks be a set containing all the MediaStreamTrack objects in the MediaStream track set.
    • A sequence of MediaStreamTrack objects:
      Let tracks be a set containing all the MediaStreamTrack objects in the provided sequence.
  2. For each MediaStreamTrack track, in tracks, run the following steps:
    1. If track is already in stream's track set, skip track.
    2. Otherwise, add track to stream's track set.
4. Return stream.
```

Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/468 using your GitHub account

Received on Tuesday, 20 June 2017 08:29:23 UTC