webex / webex-js-sdk

JavaScript SDK for Webex
https://webex.github.io/webex-js-sdk/
Other
169 stars 336 forks source link

Web 3.0 sdk: Screenshare from electron app #3629

Closed lak-16 closed 1 month ago

lak-16 commented 1 month ago

Describe the bug Staring screenshare from electron app throwing below error {type: 'CREATE_STREAM_FAILED', message: 'Failed to create display stream: NotSupportedError: Not supported'}

To Reproduce Try running sample app(https://webex.github.io/webex-js-sdk/samples/browser-plugin-meetings/) inside an electron app and do screenshare and see the error.

Additional context In 2.0 sdk I use below snippet to get the stream and I use that stream to send. navigator.mediaDevices.getUserMedia({ audio: false, video: { mandatory: { chromeMediaSource: 'desktop', chromeMediaSourceId: sourceId } } });

In 3.0 sdk I can not send the stream received. I had to use createDisplayStream() and publish this stream.

Let me know using 3.0 sdk, if I can publish stream returned by navigator.mediaDevices.getUserMedia()

ralagana commented 1 month ago

Hello @lak-16 ,

I would recommend checking our migration wiki from v2 to v3 of the SDK, as there have been changes with regards to Media handling. See here for the changes and how to work through them: https://github.com/webex/webex-js-sdk/wiki/Migrating-SDK-Version-1-or-Version-2-to-Version-3. Let us know in case of any queries.

Thanks, Raffaele

lak-16 commented 1 month ago

@ralagana I had gone through it. To start screenshare I have to use createDisplayStreamWithAudio or createDisplayStream. Using these methods works fine in a web browser. But when I run this web page inside electron app try start screenshare I get the NotSupportedError.

Anyways I can get the stream using different approach but I cannot publish that stream as it is not in sdk expected format. How can make the stream to be in sdk expected format?

ralagana commented 1 month ago

@lak-16 can you share the full console logs for the failed attempt?

Also, is there a way for us to get access to the electron app you mention, so that we can test too?

It might help to create a support ticket with us for this, by emailing devsupport@webex.com with all the info. We monitor that more than this repo for issues, so we're quicker to reply there. Up to you of course, we can continue here if needed.

Thanks, Raffaele

lak-16 commented 1 month ago

@ralagana am using below code to get the stream and to convert to sdk expected format and then publish it as screenshare video.

const stream = await navigator.mediaDevices.getUserMedia({...}) const streamInWebexFormat = await new webex.meetings.mediaHelpers.LocalDisplayStream(stream);

With this, am able to pass the stream which I generated.

ralagana commented 1 month ago

@lak-16 ok so that's resolved the issue for you then, is that correct?

sreenara commented 1 month ago

@ralagana am using below code to get the stream and to convert to sdk expected format and then publish it as screenshare video.

const stream = await navigator.mediaDevices.getUserMedia({...}) const streamInWebexFormat = await new webex.meetings.mediaHelpers.LocalDisplayStream(stream);

With this, am able to pass the stream which I generated.

Nice workaround @lak-16 . This will be helpful for other developers too. We'll add this to our documents to float this use-case!