chromium/third_party/blink/renderer/modules/mediastream/media_stream_constraints.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.

enum DisplayMediaIncludeOrExclude { "include", "exclude" };

typedef DisplayMediaIncludeOrExclude SystemAudioPreferenceEnum;
typedef DisplayMediaIncludeOrExclude SelfCapturePreferenceEnum;
typedef DisplayMediaIncludeOrExclude SurfaceSwitchingPreferenceEnum;
typedef DisplayMediaIncludeOrExclude MonitorTypeSurfacesEnum;

// https://w3c.github.io/mediacapture-main/#idl-def-mediastreamconstraints
// The name differs from the spec because the name MediaStreamConstraints
// is used internally to hold all media stream constraints from getUserMedia()
// and getDisplayMedia().
dictionary UserMediaStreamConstraints {
    (boolean or MediaTrackConstraints) video = false;
    (boolean or MediaTrackConstraints) audio = false;
    // TODO(crbug.com/1382520): Remove the controller.
    [RuntimeEnabled = CaptureController] CaptureController controller;
};

// https://www.w3.org/TR/screen-capture/#dom-displaymediastreamoptions
dictionary DisplayMediaStreamOptions {
    (boolean or MediaTrackConstraints) video = true;
    (boolean or MediaTrackConstraints) audio = false;

    // https://wicg.github.io/prefer-current-tab/#prefer-current-tab
    boolean preferCurrentTab = false;
    [
      RuntimeEnabled = GetAllScreensMedia
    ] boolean autoSelectAllScreens = false;

    // https://w3c.github.io/mediacapture-screen-share/#dom-displaymediastreamoptions-controller
    [
      RuntimeEnabled = CaptureController
    ] CaptureController controller;

    SelfCapturePreferenceEnum selfBrowserSurface;
    SystemAudioPreferenceEnum systemAudio;
    SurfaceSwitchingPreferenceEnum surfaceSwitching;
    MonitorTypeSurfacesEnum monitorTypeSurfaces;
};

// This dictionnary is used internally to hold all members from
// UserMediaStreamConstraints and DisplayMediaStreamOptions dictionary
// passed respectively to getUserMedia() and getDisplayMedia().
// UserMediaStreamConstraints and DisplayMediaStreamOptions are converted to
// MediaStreamConstraints and consumed by MediaDevices::SendUserMediaRequest().
dictionary MediaStreamConstraints {
    (boolean or MediaTrackConstraints) video = false;
    (boolean or MediaTrackConstraints) audio = false;
    boolean preferCurrentTab = false;
    boolean autoSelectAllScreens = false;
    CaptureController controller;
    SelfCapturePreferenceEnum selfBrowserSurface;
    SystemAudioPreferenceEnum systemAudio;
    SurfaceSwitchingPreferenceEnum surfaceSwitching;
    MonitorTypeSurfacesEnum monitorTypeSurfaces;
};