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/.
6 * The origin of this IDL file is
7 * http://dev.w3.org/2011/webrtc/editor/getusermedia.html
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
13 [Func="Navigator::HasUserMediaSupport",
15 interface MediaDevices : EventTarget {
16 [Pref="media.ondevicechange.enabled"]
17 attribute EventHandler ondevicechange;
18 MediaTrackSupportedConstraints getSupportedConstraints();
20 [NewObject, UseCounter]
21 Promise<sequence<MediaDeviceInfo>> enumerateDevices();
23 [NewObject, NeedsCallerType, UseCounter]
24 Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints = {});
26 // We need [SecureContext] in case media.devices.insecure.enabled = true
27 // because we don't want that legacy pref to expose this newer method.
28 [SecureContext, Pref="media.getdisplaymedia.enabled", NewObject, NeedsCallerType, UseCounter]
29 Promise<MediaStream> getDisplayMedia(optional DisplayMediaStreamConstraints constraints = {});
32 // https://w3c.github.io/mediacapture-output/#audiooutputoptions-dictionary
33 dictionary AudioOutputOptions {
34 DOMString deviceId = "";
36 // https://w3c.github.io/mediacapture-output/#mediadevices-extensions
37 partial interface MediaDevices {
38 [SecureContext, Pref="media.setsinkid.enabled", NewObject, NeedsCallerType]
39 Promise<MediaDeviceInfo> selectAudioOutput(optional AudioOutputOptions options = {});