aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_bindings/webidls/MediaDevices.webidl
blob: 8d14e60abb5002b8eb7c92f9c5afafc4cc1b6dd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */

// https://w3c.github.io/mediacapture-main/#dom-mediadevices

[Exposed=Window,
SecureContext, Pref="dom_webrtc_enabled"]
interface MediaDevices : EventTarget {
    //                attribute EventHandler ondevicechange;
    Promise<sequence<MediaDeviceInfo>> enumerateDevices();
};

partial interface Navigator {
    // [SameObject, SecureContext]
    [Pref="dom_webrtc_enabled"] readonly        attribute MediaDevices mediaDevices;
};

partial interface MediaDevices {
    // MediaTrackSupportedConstraints getSupportedConstraints();
    Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints = {});
};


dictionary MediaStreamConstraints {
        (boolean or MediaTrackConstraints) video = false;
        (boolean or MediaTrackConstraints) audio = false;
};

dictionary DoubleRange {
             double max;
             double min;
};

dictionary ConstrainDoubleRange : DoubleRange {
             double exact;
             double ideal;
};

dictionary ULongRange {
             [Clamp] unsigned long max;
             [Clamp] unsigned long min;
};

dictionary ConstrainULongRange : ULongRange {
             [Clamp] unsigned long exact;
             [Clamp] unsigned long ideal;
};

// dictionary ConstrainBooleanParameters {
//              boolean exact;
//              boolean ideal;
// };

// dictionary ConstrainDOMStringParameters {
//              (DOMString or sequence<DOMString>) exact;
//              (DOMString or sequence<DOMString>) ideal;
// };

dictionary MediaTrackConstraints : MediaTrackConstraintSet {
             sequence<MediaTrackConstraintSet> advanced;
};

typedef ([Clamp] unsigned long or ConstrainULongRange) ConstrainULong;
typedef (double or ConstrainDoubleRange) ConstrainDouble;
// typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean;
// typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString;

dictionary MediaTrackConstraintSet {
             ConstrainULong width;
             ConstrainULong height;
             ConstrainDouble aspectRatio;
             ConstrainDouble frameRate;
             // ConstrainDOMString facingMode;
             // ConstrainDOMString resizeMode;
             // ConstrainDouble volume;
             ConstrainULong sampleRate;
             // ConstrainULong sampleSize;
             // ConstrainBoolean echoCancellation;
             // ConstrainBoolean autoGainControl;
             // ConstrainBoolean noiseSuppression;
             // ConstrainDouble latency;
             // ConstrainULong channelCount;
             // ConstrainDOMString deviceId;
             // ConstrainDOMString groupId;
};