fix: get the current conference

state['features/base/conference'].conference is not the right way to get the current conference.
See getCurrentConference selector - it accounts for joining and other states.
This commit is contained in:
Pawel Domas 2022-11-30 15:44:19 -06:00 committed by Jaya Allamsetty
parent f42772ec5b
commit af072c3070
2 changed files with 8 additions and 7 deletions

View File

@ -477,18 +477,19 @@ export function participantMutedUs(participant: any, track: any) {
/** /**
* Action to create a virtual screenshare participant. * Action to create a virtual screenshare participant.
* *
* @param {(string)} sourceName - JitsiTrack instance. * @param {(string)} sourceName - The source name of the JitsiTrack instance.
* @param {(boolean)} local - JitsiTrack instance. * @param {(boolean)} local - Whether it's a local or remote participant.
* @param {JitsiConference} conference - The conference instance for which the participant is to be created.
* @returns {Function} * @returns {Function}
*/ */
export function createVirtualScreenshareParticipant(sourceName: string, local: boolean) { export function createVirtualScreenshareParticipant(sourceName: string, local: boolean, conference: any) {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const state = getState(); const state = getState();
const ownerId = getVirtualScreenshareParticipantOwnerId(sourceName); const ownerId = getVirtualScreenshareParticipantOwnerId(sourceName);
const ownerName = getParticipantDisplayName(state, ownerId); const ownerName = getParticipantDisplayName(state, ownerId);
dispatch(participantJoined({ dispatch(participantJoined({
conference: state['features/base/conference'].conference, conference,
fakeParticipant: local ? FakeParticipant.LocalScreenShare : FakeParticipant.RemoteScreenShare, fakeParticipant: local ? FakeParticipant.LocalScreenShare : FakeParticipant.RemoteScreenShare,
id: sourceName, id: sourceName,
name: ownerName name: ownerName

View File

@ -46,7 +46,7 @@ function _updateScreenshareParticipants({ getState, dispatch }: IStore) {
if (getMultipleVideoSendingSupportFeatureFlag(state)) { if (getMultipleVideoSendingSupportFeatureFlag(state)) {
if (!localScreenShare && newLocalSceenshareSourceName) { if (!localScreenShare && newLocalSceenshareSourceName) {
dispatch(createVirtualScreenshareParticipant(newLocalSceenshareSourceName, true)); dispatch(createVirtualScreenshareParticipant(newLocalSceenshareSourceName, true, conference));
} }
if (localScreenShare && !newLocalSceenshareSourceName) { if (localScreenShare && !newLocalSceenshareSourceName) {
@ -68,7 +68,7 @@ function _updateScreenshareParticipants({ getState, dispatch }: IStore) {
} }
if (addedScreenshareSourceNames.length) { if (addedScreenshareSourceNames.length) {
addedScreenshareSourceNames.forEach(id => dispatch(createVirtualScreenshareParticipant(id, false))); addedScreenshareSourceNames.forEach(id => dispatch(
createVirtualScreenshareParticipant(id, false, conference)));
} }
} }