MediaDevices.webidl (1679B)
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 [Func="Navigator::HasUserMediaSupport", 14 Exposed=Window] 15 interface MediaDevices : EventTarget { 16 attribute EventHandler ondevicechange; 17 MediaTrackSupportedConstraints getSupportedConstraints(); 18 19 [NewObject, UseCounter] 20 Promise<sequence<MediaDeviceInfo>> enumerateDevices(); 21 22 [NewObject, NeedsCallerType, UseCounter] 23 Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints = {}); 24 25 // We need [SecureContext] in case media.devices.insecure.enabled = true 26 // because we don't want that legacy pref to expose this newer method. 27 [SecureContext, Pref="media.getdisplaymedia.enabled", NewObject, NeedsCallerType, UseCounter] 28 Promise<MediaStream> getDisplayMedia(optional DisplayMediaStreamConstraints constraints = {}); 29 }; 30 31 // https://w3c.github.io/mediacapture-output/#audiooutputoptions-dictionary 32 dictionary AudioOutputOptions { 33 DOMString deviceId = ""; 34 }; 35 // https://w3c.github.io/mediacapture-output/#mediadevices-extensions 36 partial interface MediaDevices { 37 [SecureContext, Pref="media.setsinkid.enabled", NewObject, NeedsCallerType] 38 Promise<MediaDeviceInfo> selectAudioOutput(optional AudioOutputOptions options = {}); 39 };