Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(external_api) facilitate gDM Electron #15575

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

saghul
Copy link
Member

@saghul saghul commented Feb 6, 2025

In order to use gDM in Electron the flow is somewhat reversed. It starts from the Electron main process, so we need an API in the external_api that can trigger the builtin picker. The picker is still necessary.

@saghul saghul marked this pull request as ready for review February 6, 2025 12:48
conference.js Outdated
@@ -175,6 +175,7 @@ let room;
* lib-jitsi-meet to detect and invoke
*/
window.JitsiMeetScreenObtainer = {
gDMSupported: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we ok with not including a version check here just in case? gDM has been supported since M72 but do we know if it will work as expected with electron starting 72? IMHO, it will be safer to stick to versions we know where it works as expected.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll add an extra check to LJM.

This flag means JM has the necessary APIs to make it work via the iframe API but LJM should decide which flow to use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah makes sense to add it there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a second thought, note that the new behavior will only happen in the Electron SDK 7 (currently unreleased).

I think supporting a > 2 year old electron with the new SDK is not in the cards.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it is failing?

I'm also wondering isn't it better to pass this to LJM instead of having it as a global? Or for some reason we can't do that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass how? During init?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. About the passing - I guess init of LJM works or maybe as part of createLocalTrack.

  2. I'm sorry for the question, I'm almost certain I'm missing something here. I kind of don't understand why do we need this flag at all. Is it to accommodate use cases where somebody will use only LJM without jitsi-meet?

What I'm confused is that for all new versions after this PR we will have this flag set to true and in LJM we will only execute the code from the if branch where the flag is true and for the versions before this PR we will just have the old code. I mean since jitsi-meet is tied to a specific LJM version what is the point of the flag. Do we check it somewhere else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me take another look.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I took another approach. See: jitsi/lib-jitsi-meet#2634

Basically, we always try gDM first, and fallback to the previous flow if it's not supported (there is a specific exception that Electron throws).

Thus, we no longer need this flag (that's how I started but got lost along the way).

I also left comments both here and in LJM so we axe all the old code (and the global!) once an SDK supporting gDM has been out for a while.

@saghul
Copy link
Member Author

saghul commented Feb 6, 2025

Jenkins please test this please.

conference.js Outdated
@@ -175,6 +175,7 @@ let room;
* lib-jitsi-meet to detect and invoke
*/
window.JitsiMeetScreenObtainer = {
gDMSupported: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we ok with not including a version check here just in case? gDM has been supported since M72 but do we know if it will work as expected with electron starting 72? IMHO, it will be safer to stick to versions we know where it works as expected.

* after with the legacy SS suport was removed from the electron SDK. If we remove it now the SS for Electron
* clients with older versions wont work.
*/
_isNewElectronScreensharingSupported() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing this?

The support for this was recently removed in the electron-sdk (a3622a3). Shouldn't we wait for a bit the ^^^ commit to be released in the clients? If it is not released it seems that we are going to fallback to the old flow just because this function is missing....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old flow is gone, so there is no point in keeping the check any longer. Arguably this should have been made in a3622a3 because there are no longer 2 flows. It's just the new one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I restored this. We have a bit of a mess here so I got a bit confused. I think we need to bump the Electron SDK to 7 and then after a while to 8, where we only leave the new-new way of doing SS, using gDM and gDM only.

@@ -1046,8 +1046,20 @@ function initCommands() {
callback(conference?.getMeetingUniqueId() || '');
break;
}
case '_new_electron_screensharing_supported': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored.

@@ -159,7 +159,7 @@ async function _toggleScreenSharing(
} catch (error) {
dispatch(handleScreenSharingError(error, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));

throw error;
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the commit log. Nobody catches the exception so it's thrown into the void. We are already handling the error above and also logging it in LJM so there is nothing the throw here accomplishes.

@@ -173,7 +173,7 @@ async function _toggleScreenSharing(
if (!desktopAudioTrack) {
dispatch(handleScreenSharingError(AUDIO_ONLY_SCREEN_SHARE_NO_TRACK, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));

throw new Error(AUDIO_ONLY_SCREEN_SHARE_NO_TRACK);
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

There is nobody to catch it and we already show the error as a
notification.
@saghul saghul force-pushed the electron-gdm branch 2 times, most recently from 84639c3 to c569890 Compare February 11, 2025 21:08
In order to use gDM in Electron the flow is somewhat reversed. It starts
from the Electron main process, so we need an API in the external_api
that can trigger the builtin picker. The picker is still necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants