Skip to content

Is it possible to desktop capture with cursor hidden? #7584

Closed

Description

@rnrneverdies

I need to capture the screen but not capturing the mouse pointer. I'm combining desktopCapture and getUserMedia APIs as explained in the docs to capture the video, but that's also capturing the cursor.

Can you point me out on what I need to do to remove the cursor from the MediaStream?

Thanks in advance!

Activity

  1. zcbenz commented on Oct 24, 2016

    @zcbenz
    Contributor

    Currently there is no way to do that, I suggest bringing this up at Chromium's issues list, Electron is just using Chromium for the desktop capture and we are not able to add this feature on Electron's side.

  2. SimplyAhmazing commented on Oct 11, 2017

    @SimplyAhmazing

    In case anyone needs this: I'm doing screenshot based testing for an electron app and I'm running this before taking a screenshot to remove the cursor,

    // Remove cursor from page before taking a screenshot
     app.webContents.executeJavaScript('setImmediate(function blur() { document.activeElement.blur(); })')
  3. rmnprt commented on Oct 1, 2018

    @rmnprt

    @SimplyAhmazing That din't work for me, on Windows 10 at least. Is there any better way of doing this, one year down the line, with electron 3.x

  4. CapOM commented on Jul 5, 2019

    @CapOM
    Contributor
  5. emptycrown commented on Feb 25, 2020

    @emptycrown

    This is enabled? How do you incorporate other MediaTrackConstraints parameters into the desktopCapturer template from the docs?

    video: {
                mandatory: {
                  chromeMediaSource: 'desktop',
                  chromeMediaSourceId: source.id,
                  minWidth: 1280,
                  maxWidth: 1280,
                  minHeight: 720,
                  maxHeight: 720
                }
    }
    
  6. munjalpatel commented on Mar 30, 2020

    @munjalpatel

    This is enabled? How do you incorporate other MediaTrackConstraints parameters into the desktopCapturer template from the docs?

    video: {
                mandatory: {
                  chromeMediaSource: 'desktop',
                  chromeMediaSourceId: source.id,
                  minWidth: 1280,
                  maxWidth: 1280,
                  minHeight: 720,
                  maxHeight: 720
                }
    }
    

    I am also trying to figure that out. Can't find a good documentation for it anywhere.

  7. CapOM commented on Mar 30, 2020

    @CapOM
    Contributor
  8. hackers365 commented on Jun 3, 2021

    @hackers365

    any update?

  9. danielehrhardt commented on Jul 16, 2023

    @danielehrhardt
  10. alekye commented on Jul 31, 2023

    @alekye

    what about cursor now?

  11. Merry9 commented on Dec 15, 2023

    @Merry9

    我通过 C++ 提供的接口将鼠标指针隐藏了,但是截图 捕获的图像中还是包含了鼠标
    我在想,是我调用接口的时机不对吗?但是我在用户点击截图按钮和系统开始捕获图像时都马上调用了函数并且等接口返回结果才开始进行下一步的
    想不明白这里为啥不正常?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions