[mediacapture-main] Should we revisit and document getUserMedia() track order? (#1028)

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

== Should we revisit and document getUserMedia() track order? ==
The spec [says](https://w3c.github.io/mediacapture-main/getusermedia.html#dfn-track-set): _"The tracks of a [MediaStream](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediastream) are stored in a **track set**. The track set MUST contain the [MediaStreamTrack](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediastreamtrack) objects that correspond to the tracks of the stream. The relative order of the tracks in the set is User Agent defined and the API will never put any requirements on the order. The proper way to find a specific [MediaStreamTrack](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediastreamtrack) object in the set is to look it up by its [id](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediastreamtrack-id)."_

But https://github.com/w3c/mediacapture-main/issues/1020 is concerned about deterministic event order between track clones, looking at using track creation order.

If we're chasing determinism at this level, might `getUserMedia` need to be clearer about whether it creates its audio or video track first?

I suspect audio comes first, [given](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediadevices-getusermedia) _"2. Let requestedMediaTypes be the set of media types in constraints with either a dictionary value or a value of true... 11.3 For each media type kind in requestedMediaTypes ..."_, and the fact that dictionary members are sorted lexographically.

While use of the word _"set"_ in the sentences above do **_not_** link to [set](https://infra.spec.whatwg.org/#sets), they might be understood to mean the same thing. It reads:
<img width="1070" alt="Image" src="https://github.com/user-attachments/assets/c5b82b3f-3732-458a-bcb1-b54b3de61d9f" />

Thankfully, an [implementation check](https://jsfiddle.net/jib1/y0rqk35a/) reveals the same order in all browsers: `audio, video`. Is it time to document this?

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 17 January 2025 22:16:41 UTC