fix(audio-only-ss): Attach a track stopped handler to the audioDesktop track only for audio-only sharing case.

There will be an audio desktop track for regular screensahring when a tab is selected. We do not have to toggle screensharing again when that track is killed.
This commit is contained in:
Jaya Allamsetty 2022-08-11 15:00:15 -04:00
parent 3d60773963
commit ca095240b9
1 changed files with 6 additions and 6 deletions

View File

@ -231,12 +231,12 @@ async function _toggleScreenSharing({ enabled, audioOnly = false, shareOptions =
_maybeApplyAudioMixerEffect(desktopAudioTrack, state);
dispatch(setScreenshareAudioTrack(desktopAudioTrack));
// Handle the case where screen share was stopped from the browsers 'screen share in progress' window.
desktopAudioTrack.on(
JitsiTrackEvents.LOCAL_TRACK_STOPPED,
() => {
dispatch(toggleScreensharing(undefined, true));
});
// Handle the case where screen share was stopped from the browsers 'screen share in progress' window.
if (audioOnly) {
desktopAudioTrack?.on(
JitsiTrackEvents.LOCAL_TRACK_STOPPED,
() => dispatch(toggleScreensharing(undefined, true)));
}
}
// Disable audio-only or best performance mode if the user starts screensharing. This doesn't apply to