desktopCapturer

    Process: Main

    The following example shows how to capture video from a desktop window whose title is Electron:

    To capture both audio and video from the entire desktop the constraints passed to must include chromeMediaSource: 'desktop', for both audio and , but should not include a chromeMediaSourceId constraint.

    The desktopCapturer module has the following methods:

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

    Caveats

    does not work on macOS for audio capture due to a fundamental limitation whereby apps that want to access the system’s audio require a signed kernel extension. Chromium, and by extension Electron, does not provide this.