W3C home > Mailing lists > Public > public-media-capture@w3.org > October 2016

[mediacapture-main] Remove unions in MediaTrackCapabilities

From: jan-ivar via GitHub <sysbot+gh@w3.org>
Date: Sat, 08 Oct 2016 00:05:26 +0000
To: public-media-capture@w3.org
Message-ID: <issues.opened-181790766-1475885124-sysbot+gh@w3.org>
jan-ivar has just created a new issue for 

== Remove unions in MediaTrackCapabilities ==
Unions may be convenient in input, but add unnecessary variance 
tripping up code on output.

A parsing nightmare, even with destructuring:
let {width, height} = track.getCapabilities();
let maxWidth = (typeof width == "object")? width.max : width;
let maxHeight = height.max || height; // works in some cases, not 
booleans though

We should remove all unions in 
 like this:

dictionary MediaTrackCapabilities {
    LongRange           width;
    LongRange           height;
    DoubleRange         aspectRatio;
    DoubleRange         frameRate;
    sequence<DOMString> facingMode;
    DoubleRange         volume;
    LongRange           sampleRate;
    LongRange           sampleSize;
    sequence<boolean>   echoCancellation;
    DoubleRange         latency;
    LongRange           channelCount;
    DOMString           deviceId;
    DOMString           groupId;

For straight up parsing:
let {width: {max: maxWidth}, height: {max: maxHeight}} = 

Please view or discuss this issue at 
https://github.com/w3c/mediacapture-main/issues/408 using your GitHub 
Received on Saturday, 8 October 2016 00:05:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:26:37 UTC