|
| 1 | +/** |
| 2 | + * @see https://w3c.github.io/mediacapture-screen-share |
| 3 | + */ |
| 4 | + |
| 5 | +declare global { |
| 6 | + interface MediaDevices { |
| 7 | + getDisplayMedia(options?: DisplayMediaStreamOptions): Promise<MediaStream>; |
| 8 | + } |
| 9 | +} |
| 10 | + |
| 11 | +export interface UserMediaStreamConstraints { |
| 12 | + /** @default false */ |
| 13 | + video?: boolean | MediaTrackConstraints; |
| 14 | + /** @default false */ |
| 15 | + audio?: boolean | MediaTrackConstraints; |
| 16 | +} |
| 17 | + |
| 18 | +export type CaptureStartFocusBehavior = |
| 19 | + | "focus-capturing-application" |
| 20 | + | "focus-captured-surface" |
| 21 | + | "no-focus-change"; |
| 22 | + |
| 23 | +declare global { |
| 24 | + class CaptureController extends EventTarget { |
| 25 | + constructor(); |
| 26 | + setFocusBehavior(focusBehavior: CaptureStartFocusBehavior): void; |
| 27 | + } |
| 28 | +} |
| 29 | + |
| 30 | +export type SelfCapturePreferenceEnum = |
| 31 | + | "include" |
| 32 | + | "exclude"; |
| 33 | + |
| 34 | +export type SystemAudioPreferenceEnum = |
| 35 | + | "include" |
| 36 | + | "exclude"; |
| 37 | + |
| 38 | +export type WindowAudioPreferenceEnum = |
| 39 | + | "system" |
| 40 | + | "window" |
| 41 | + | "exclude"; |
| 42 | + |
| 43 | +export type SurfaceSwitchingPreferenceEnum = |
| 44 | + | "include" |
| 45 | + | "exclude"; |
| 46 | + |
| 47 | +export type MonitorTypeSurfacesEnum = |
| 48 | + | "include" |
| 49 | + | "exclude"; |
| 50 | + |
| 51 | +export interface DisplayMediaStreamOptions { |
| 52 | + /** @default true */ |
| 53 | + video?: boolean | MediaTrackConstraints; |
| 54 | + /** @default false */ |
| 55 | + audio?: boolean | MediaTrackConstraints; |
| 56 | + controller?: CaptureController; |
| 57 | + selfBrowserSurface?: SelfCapturePreferenceEnum; |
| 58 | + systemAudio?: SystemAudioPreferenceEnum; |
| 59 | + windowAudio?: WindowAudioPreferenceEnum; |
| 60 | + surfaceSwitching?: SurfaceSwitchingPreferenceEnum; |
| 61 | + monitorTypeSurfaces?: MonitorTypeSurfacesEnum; |
| 62 | +} |
| 63 | + |
| 64 | +export interface MediaTrackSupportedConstraints { |
| 65 | + /** @default true */ |
| 66 | + displaySurface?: boolean; |
| 67 | + /** @default true */ |
| 68 | + logicalSurface?: boolean; |
| 69 | + /** @default true */ |
| 70 | + cursor?: boolean; |
| 71 | + /** @default true */ |
| 72 | + restrictOwnAudio?: boolean; |
| 73 | + /** @default true */ |
| 74 | + suppressLocalAudioPlayback?: boolean; |
| 75 | +} |
| 76 | + |
| 77 | +export interface MediaTrackConstraintSet { |
| 78 | + displaySurface?: ConstrainDOMString; |
| 79 | + logicalSurface?: ConstrainBoolean; |
| 80 | + cursor?: ConstrainDOMString; |
| 81 | + restrictOwnAudio?: ConstrainBoolean; |
| 82 | + suppressLocalAudioPlayback?: ConstrainBoolean; |
| 83 | +} |
| 84 | + |
| 85 | +export interface MediaTrackSettings { |
| 86 | + displaySurface?: string; |
| 87 | + logicalSurface?: boolean; |
| 88 | + cursor?: string; |
| 89 | + restrictOwnAudio?: boolean; |
| 90 | + suppressLocalAudioPlayback?: boolean; |
| 91 | + screenPixelRatio?: number; |
| 92 | +} |
| 93 | + |
| 94 | +export interface MediaTrackCapabilities { |
| 95 | + displaySurface?: string; |
| 96 | + logicalSurface?: boolean; |
| 97 | + cursor?: string[]; |
| 98 | +} |
| 99 | + |
| 100 | +export type DisplayCaptureSurfaceType = |
| 101 | + | "monitor" |
| 102 | + | "window" |
| 103 | + | "browser"; |
| 104 | + |
| 105 | +export type CursorCaptureConstraint = |
| 106 | + | "never" |
| 107 | + | "always" |
| 108 | + | "motion"; |
0 commit comments