Skip to content

polling desktopCapturer.getSources() crashes the electron app #11304

Closed

Description

@deeptabs

Electron version: 1.7.9
Operating system: OSX

Expected behavior

App should not crash when desktopCapturer.getSources() is polled.

Actual behavior

Calling desktopCapturer.getSources() causes the app to crash, using the code this way

pollForDesktopCapturer: function(){
         var self= this;
         electron.desktopCapturer.getSources({types: ['window', 'screen']}, function(error, sources) {
             if (error) throw Logger.error("error getting screen share content --- ", error);
             self.model.set('screens', sources);
             setTimeout(self.pollForDesktopCapturer.bind(self), 7000);
        });
},

Why am i polling?

Need to update users with the latest screen capture of the apps open every 5 to 7 seconds, even if the user opens an app freshly. I realise that getSources is a highly-expensive API and it is not advised to poll. Is there an alternative method i can use?
Considering that i need the source id of the app since i need to start screen share of the app when the user clicks on the image displayed.

Activity

  1. welcome commented on Dec 1, 2017

    @welcome

    👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

    To help make it easier for us to investigate your issue, please follow the contributing guidelines.

  2. anand-io commented on Dec 1, 2017

    @anand-io

    This is happening for us too.

    • Electron version: any version with electron.desktopCapturer.getSources API
    • Operating system: OSX High Sierra 10.13.1

    Steps to reproduce:

    Call the below code more than once(mostly between 1-10 times), the app will crash.

    require('electron').desktopCapturer.getSources({ types: ['screen'] }, (error, sources) => {
        console.log(sources[0].id);
    });
    

    Note: this is happening only in OSX High Sierra

  3. Nikitikitavi commented on Dec 6, 2017

    @Nikitikitavi

    +1
    Same situation.

    As understand @rongilson in this issue #9600 able to fix the problem. But I don't understand how to implement his fix, no those folders in electron project.

    Any update on this?

  4. Ajeey commented on Dec 7, 2017

    @Ajeey
    Contributor

    +1

    I am able to easily reproduce this issue on Mac.
    Here is the sample repo that demonstrates the issue
    https://github.com/Ajeey/electron-crash-demo

  5. kamesh-a commented on Dec 7, 2017

    @kamesh-a

    +1

  6. Ajeey commented on Dec 14, 2017

    @Ajeey
    Contributor

    @zcbenz @zeke @MarshallOfSound Can we get some attention on the above issue please?
    It is turning out to be a show stopper for us :(

  7. zeke commented on Jan 24, 2018

    @zeke
    Contributor

    Looks like a fix for this landed in electron/libchromiumcontent#418

  8. jstlaurent commented on Jan 24, 2018

    @jstlaurent

    @zeke, was this bundled with today's releases (1.7.11, 1.8.2-beta4)? I'm still new to developing with Electron, so I'm unsure where I can see if that's the case.

  9. zeke commented on Jan 25, 2018

    @zeke
    Contributor

    @jstlaurent I think this will land in 2.0.0. Not sure we have a target date for that yet.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions