chromium/third_party/blink/renderer/modules/mediastream/media_devices.idl

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// The spec for MediaDevices is in two parts:
// https://w3c.github.io/mediacapture-main/#mediadevices
// https://w3c.github.io/mediacapture-main/#mediadevices-interface-extensions

[
    Exposed=Window,
    ActiveScriptWrappable,
    SecureContext
] interface MediaDevices : EventTarget {
    [RuntimeEnabled=OnDeviceChange] attribute EventHandler ondevicechange;
    [
      CallWith = ScriptState, RaisesException, HighEntropy, MeasureAs = MediaDevicesEnumerateDevices
    ] Promise<sequence<MediaDeviceInfo>>
    enumerateDevices();
    MediaTrackSupportedConstraints getSupportedConstraints();
    [
      CallWith = ScriptState, RaisesException, HighEntropy, MeasureAs = GetUserMediaPromise
    ] Promise<MediaStream>
    getUserMedia(optional UserMediaStreamConstraints constraints = {});

    // https://w3c.github.io/mediacapture-screen-share/#dom-mediadevices-getdisplaymedia
    [
      RuntimeEnabled = GetDisplayMedia, CallWith = ScriptState, RaisesException,
      MeasureAs = GetDisplayMedia
    ] Promise<MediaStream>
    getDisplayMedia(optional DisplayMediaStreamOptions constraints = {});

    [
      RuntimeEnabled = GetAllScreensMedia, CallWith = ScriptState, RaisesException,
      MeasureAs = GetAllScreensMedia, InjectionMitigated
    ] Promise<sequence<MediaStream>>
    getAllScreensMedia();

    // https://w3c.github.io/mediacapture-handle/identity/
    // Allows an application APP to opt-in to exposing certain information to
    // applications which end up capturing APP.
    [
      RuntimeEnabled = CaptureHandle, CallWith = ScriptState, RaisesException
    ] void
    setCaptureHandleConfig(optional CaptureHandleConfig config = {});
};