webex/webex-js-sdk

Web 3.0 sdk: Screenshare from electron app

lak-16 opened this issue · 6 comments

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()

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

@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?

@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

@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.

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

@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!