Screen Sharing Permission in Electron App

Description
I have an electron app and need to share my screen. Upon loading the app I prompt the user for audio, video, and screen recording permissions if they have not already done so.

I am trying to start sharing my screen via the following function:

    async startScreenShare(canvas: HTMLCanvasElement) {
        const client = await this.client();
        const stream = await client.getMediaStream();

        return stream?.startShareScreen(canvas);
    }

I can get a stream in the electron browser window with:

navigator.mediaDevices.getUserMedia({
    video: { mandatory: { chromeMediaSource: 'desktop' } }
});

I can also get access to user screen using the electron desktopCapturer:

desktopCapturer
    .getSources({ types: ['window', 'screen'] })
    .then((resp) => console.log('desktp get sources: ', resp));

So as far as the electron app is concerned, it appears to have all the permissions it needs. It prompted for recording permission and I gave it. But whenever I try to call the zoom client.startScreenShare(), it says “user deny permission”.

Error
{
type: “INVALID_OPERATION”,
reason: “user deny screen share”
}

Which Web Video SDK version?
1.1.0

Screenshots
If applicable, add screenshots to help explain your problem.

Device (please complete the following information):

  • Device: Macbook
  • OS: Catalina: 10.15.7
  • Browser: Electron
  • Browser Version 8.5.5

Hey @chris.7771 ,

Happy to help! Do you have the active-share-change event listener in your code? Try implementing this and see if it resolves the error: https://marketplace.zoom.us/docs/sdk/video/web/essential/screen-share#viewing-participants-screen-sharing

If that does not work, this is possibly related to: Electron + WebSDK Screensharing not working (@zoomus/websdk v1.7.10)

Thanks,
Tommy

thanks for the reply.

haven’t gotten to using “active-screen-share” event yet, because I haven’t even gotten to the point where anyone can share screen yet, so since i can’t get anyone to successfully share screen, no one will be emitting any active-screen-share events.

i’ll take a look at the other post as well.

what is the difference between websdk and videosdk-web? we are using videosdk-web, the post you mentioned is using websdk.

Hey @chris.7771 ,

You can see the differences here: https://marketplace.zoom.us/docs/sdk#comparing-zoom-sdks

Even though they are different Zoom SDKs, the issue is with using the Zoom Web based SDK screen share functions in an electron web view.

Thanks,
Tommy

The linked post ends with a bug was identified and was going to be fixed in websdk version 1.8.5.
We’re using the latest videosdk. Did that fix also make it into the videosdk?

Hey @chris.7771 ,

After throughout investigation, we are placing this in our long term backlog as it seems to be an Electron limitation.

Thanks,
Tommy

Hi @tommy ,

This is definitely not a limitation with Electron. It must be an issue with how Zoom is interacting with Electron. We have had screen sharing working before in this app with another 3rd party SDK. The difference is that that SDK delegated the job of getting the screen share stream to us and then we passed them the stream. Your SDK does not give us that flexibility, but you are doing everything in a black box.

I really wish you all would make this SDK more flexible by not hiding everything in a black box.

Hey @ephraimwwt ,

Thanks for your feedback! :slight_smile: We will evaluate this.

-Tommy

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Hey @ephraimwwt , @chris.7771 ,

I have an update for you. :slight_smile:

Electron’s desktopCapturer API doesn’t provide a chromium style desktop picker dialog, so we would need to implement one.

We are evaluating where and when we can fit this into our roadmap.

Thanks,
Tommy

Thanks for the update, looking forward to it getting into the release.

1 Like

You are welcome! :slight_smile:

-Tommy