Skip to content

ElectronDesktopCapturer.getSources method

ElectronDesktopCapturer › getSources

Unofficial

Resolves with an array of DesktopCapturerSource objects, each representing a screen or an individual window that can be captured.

Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher, which can be detected via systemPreferences.getMediaAccessStatus.

Signature:

getSources(options: ElectronSourcesOptions): Promise<ElectronDesktopCapturerSource[]>

Parameters:

Parameter Type Description
options ElectronSourcesOptions Options describing which sources to capture.

Returns: Promise<ElectronDesktopCapturerSource[]>A promise resolving with the captured sources.