MediaStreamTrack.webidl (3790B)
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 17 enum VideoFacingModeEnum { 18 "user", 19 "environment", 20 "left", 21 "right" 22 }; 23 24 enum VideoResizeModeEnum { 25 "none", 26 "crop-and-scale" 27 }; 28 29 enum MediaSourceEnum { 30 "camera", 31 "screen", 32 "application", 33 "window", 34 "browser", 35 "microphone", 36 "audioCapture", 37 "other" 38 // If values are added, adjust n_values in Histograms.json (2 places) 39 }; 40 41 dictionary ConstrainLongRange { 42 long min; 43 long max; 44 long exact; 45 long ideal; 46 }; 47 48 dictionary ConstrainDoubleRange { 49 double min; 50 double max; 51 double exact; 52 double ideal; 53 }; 54 55 dictionary ConstrainBooleanParameters { 56 boolean exact; 57 boolean ideal; 58 }; 59 60 dictionary ConstrainDOMStringParameters { 61 (DOMString or sequence<DOMString>) exact; 62 (DOMString or sequence<DOMString>) ideal; 63 }; 64 65 typedef (long or ConstrainLongRange) ConstrainLong; 66 typedef (double or ConstrainDoubleRange) ConstrainDouble; 67 typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean; 68 typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString; 69 70 // Note: When adding new constraints, remember to update the SelectSettings() 71 // function in MediaManager.cpp to make OverconstrainedError's constraint work! 72 73 dictionary MediaTrackConstraintSet { 74 ConstrainLong width; 75 ConstrainLong height; 76 ConstrainDouble frameRate; 77 ConstrainDOMString facingMode; 78 ConstrainDOMString resizeMode; 79 DOMString mediaSource; 80 long long browserWindow; 81 boolean scrollWithPage; 82 ConstrainDOMString deviceId; 83 ConstrainDOMString groupId; 84 ConstrainLong viewportOffsetX; 85 ConstrainLong viewportOffsetY; 86 ConstrainLong viewportWidth; 87 ConstrainLong viewportHeight; 88 ConstrainBoolean echoCancellation; 89 ConstrainBoolean noiseSuppression; 90 ConstrainBoolean autoGainControl; 91 ConstrainLong channelCount; 92 }; 93 94 [GenerateToJSON] 95 dictionary MediaTrackConstraints : MediaTrackConstraintSet { 96 sequence<MediaTrackConstraintSet> advanced; 97 }; 98 99 enum MediaStreamTrackState { 100 "live", 101 "ended" 102 }; 103 104 [Exposed=Window] 105 interface MediaStreamTrack : EventTarget { 106 readonly attribute DOMString kind; 107 readonly attribute DOMString id; 108 [NeedsCallerType] 109 readonly attribute DOMString label; 110 attribute boolean enabled; 111 readonly attribute boolean muted; 112 attribute EventHandler onmute; 113 attribute EventHandler onunmute; 114 readonly attribute MediaStreamTrackState readyState; 115 attribute EventHandler onended; 116 MediaStreamTrack clone (); 117 undefined stop (); 118 [NeedsCallerType] 119 MediaTrackCapabilities getCapabilities (); 120 MediaTrackConstraints getConstraints (); 121 [NeedsCallerType] 122 MediaTrackSettings getSettings (); 123 124 [NewObject, NeedsCallerType] 125 Promise<undefined> applyConstraints (optional MediaTrackConstraints constraints = {}); 126 // attribute EventHandler onoverconstrained; 127 };