1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * The origin of this IDL file is
7 * http://dev.w3.org/2011/webrtc/editor/getusermedia.html
8 *
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
11 */
12
13// These two enums are in the spec even though they're not used directly in the
14// API due to https://www.w3.org/Bugs/Public/show_bug.cgi?id=19936
15// Their binding code is used in the implementation.
16
17enum VideoFacingModeEnum {
18    "user",
19    "environment",
20    "left",
21    "right"
22};
23
24enum MediaSourceEnum {
25    "camera",
26    "screen",
27    "application",
28    "window",
29    "browser",
30    "microphone",
31    "audioCapture",
32    "other"
33    // If values are added, adjust n_values in Histograms.json (2 places)
34};
35
36typedef (long or ConstrainLongRange) ConstrainLong;
37typedef (double or ConstrainDoubleRange) ConstrainDouble;
38typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean;
39typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString;
40
41// Note: When adding new constraints, remember to update the SelectSettings()
42// function in MediaManager.cpp to make OverconstrainedError's constraint work!
43
44dictionary MediaTrackConstraintSet {
45    ConstrainLong width;
46    ConstrainLong height;
47    ConstrainDouble frameRate;
48    ConstrainDOMString facingMode;
49    DOMString mediaSource = "camera";
50    long long browserWindow;
51    boolean scrollWithPage;
52    ConstrainDOMString deviceId;
53    ConstrainLong viewportOffsetX;
54    ConstrainLong viewportOffsetY;
55    ConstrainLong viewportWidth;
56    ConstrainLong viewportHeight;
57    ConstrainBoolean echoCancellation;
58    ConstrainBoolean noiseSuppression;
59    ConstrainBoolean autoGainControl;
60    ConstrainLong channelCount;
61};
62
63dictionary MediaTrackConstraints : MediaTrackConstraintSet {
64    sequence<MediaTrackConstraintSet> advanced;
65};
66
67enum MediaStreamTrackState {
68    "live",
69    "ended"
70};
71
72[Exposed=Window]
73interface MediaStreamTrack : EventTarget {
74    readonly    attribute DOMString             kind;
75    readonly    attribute DOMString             id;
76    [NeedsCallerType]
77    readonly    attribute DOMString             label;
78                attribute boolean               enabled;
79    readonly    attribute boolean               muted;
80                attribute EventHandler          onmute;
81                attribute EventHandler          onunmute;
82    readonly    attribute MediaStreamTrackState readyState;
83                attribute EventHandler          onended;
84    MediaStreamTrack       clone ();
85    void                   stop ();
86//  MediaTrackCapabilities getCapabilities ();
87    MediaTrackConstraints  getConstraints ();
88    [NeedsCallerType]
89    MediaTrackSettings     getSettings ();
90
91    [Throws, NeedsCallerType]
92    Promise<void>          applyConstraints (optional MediaTrackConstraints constraints);
93//              attribute EventHandler          onoverconstrained;
94
95    [ChromeOnly]
96    void mutedChanged(boolean muted);
97};
98