update reciver constraints to include SS source names
This commit is contained in:
parent
56ae2a56e4
commit
f87a1a0e3a
|
@ -469,6 +469,23 @@ export function getTrackSourceNameByMediaTypeAndParticipant(
|
||||||
return track?.jitsiTrack?.getSourceName();
|
return track?.jitsiTrack?.getSourceName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns track source name of specified screen share participant id.
|
||||||
|
*
|
||||||
|
* @param {Track[]} tracks - List of all tracks.
|
||||||
|
* @param {string} participantId - Participant ID.
|
||||||
|
* @returns {(string|undefined)}
|
||||||
|
*/
|
||||||
|
export function getTrackSourceNameByFakeScreenShareParticipant(
|
||||||
|
tracks,
|
||||||
|
participantId) {
|
||||||
|
const track = getFakeScreenshareParticipantTrack(
|
||||||
|
tracks,
|
||||||
|
participantId);
|
||||||
|
|
||||||
|
return track?.jitsiTrack?.getSourceName();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the track if any which corresponds to a specific instance
|
* Returns the track if any which corresponds to a specific instance
|
||||||
* of JitsiLocalTrack or JitsiRemoteTrack.
|
* of JitsiLocalTrack or JitsiRemoteTrack.
|
||||||
|
|
|
@ -10,14 +10,14 @@ import { setRemoteParticipantsWithScreenShare, fakeScreenshareParticipantsUpdate
|
||||||
import { getAutoPinSetting, updateAutoPinnedParticipant } from './functions';
|
import { getAutoPinSetting, updateAutoPinnedParticipant } from './functions';
|
||||||
|
|
||||||
StateListenerRegistry.register(
|
StateListenerRegistry.register(
|
||||||
/* selector */ state => [ ...state['features/base/participants'].sortedFakeScreenShareParticipants ],
|
/* selector */ state => state['features/base/participants'].sortedFakeScreenShareParticipants,
|
||||||
/* listener */ (sortedFakeScreenShareParticipants, store) => {
|
/* listener */ (sortedFakeScreenShareParticipants, store) => {
|
||||||
if (!getAutoPinSetting() || isFollowMeActive(store) || !getSourceNameSignalingFeatureFlag(store.getState())) {
|
if (!getAutoPinSetting() || isFollowMeActive(store) || !getSourceNameSignalingFeatureFlag(store.getState())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const oldScreenSharesOrder = store.getState()['features/video-layout'].remoteScreenShares || [];
|
const oldScreenSharesOrder = store.getState()['features/video-layout'].remoteScreenShares || [];
|
||||||
const knownSharingParticipantIds = sortedFakeScreenShareParticipants.map(p => p.id);
|
const knownSharingParticipantIds = [ ...sortedFakeScreenShareParticipants.values() ].map(p => p.id);
|
||||||
|
|
||||||
// Filter out any participants which are no longer screen sharing
|
// Filter out any participants which are no longer screen sharing
|
||||||
// by looping through the known sharing participants and removing any
|
// by looping through the known sharing participants and removing any
|
||||||
|
|
|
@ -7,7 +7,10 @@ import { getSourceNameSignalingFeatureFlag } from '../base/config';
|
||||||
import { MEDIA_TYPE } from '../base/media';
|
import { MEDIA_TYPE } from '../base/media';
|
||||||
import { getLocalParticipant, getParticipantCount } from '../base/participants';
|
import { getLocalParticipant, getParticipantCount } from '../base/participants';
|
||||||
import { StateListenerRegistry } from '../base/redux';
|
import { StateListenerRegistry } from '../base/redux';
|
||||||
import { getTrackSourceNameByMediaTypeAndParticipant } from '../base/tracks';
|
import {
|
||||||
|
getTrackSourceNameByFakeScreenShareParticipant,
|
||||||
|
getTrackSourceNameByMediaTypeAndParticipant
|
||||||
|
} from '../base/tracks';
|
||||||
import { reportError } from '../base/util';
|
import { reportError } from '../base/util';
|
||||||
import {
|
import {
|
||||||
getVideoQualityForLargeVideo,
|
getVideoQualityForLargeVideo,
|
||||||
|
@ -235,7 +238,13 @@ function _updateReceiverVideoConstraints({ getState }) {
|
||||||
|
|
||||||
if (visibleRemoteParticipants?.size) {
|
if (visibleRemoteParticipants?.size) {
|
||||||
visibleRemoteParticipants.forEach(participantId => {
|
visibleRemoteParticipants.forEach(participantId => {
|
||||||
const sourceName = getTrackSourceNameByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, participantId);
|
let sourceName;
|
||||||
|
|
||||||
|
if (remoteScreenShares.includes(participantId)) {
|
||||||
|
sourceName = getTrackSourceNameByFakeScreenShareParticipant(tracks, participantId);
|
||||||
|
} else {
|
||||||
|
sourceName = getTrackSourceNameByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, participantId);
|
||||||
|
}
|
||||||
|
|
||||||
if (sourceName) {
|
if (sourceName) {
|
||||||
visibleRemoteTrackSourceNames.push(sourceName);
|
visibleRemoteTrackSourceNames.push(sourceName);
|
||||||
|
@ -244,9 +253,8 @@ function _updateReceiverVideoConstraints({ getState }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localParticipantId !== largeVideoParticipantId) {
|
if (localParticipantId !== largeVideoParticipantId) {
|
||||||
largeVideoSourceName = getTrackSourceNameByMediaTypeAndParticipant(
|
largeVideoSourceName = getTrackSourceNameByFakeScreenShareParticipant(
|
||||||
tracks, MEDIA_TYPE.VIDEO,
|
tracks, largeVideoParticipantId
|
||||||
largeVideoParticipantId
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +271,7 @@ function _updateReceiverVideoConstraints({ getState }) {
|
||||||
// Prioritize screenshare in tile view.
|
// Prioritize screenshare in tile view.
|
||||||
if (remoteScreenShares?.length) {
|
if (remoteScreenShares?.length) {
|
||||||
const remoteScreenShareSourceNames = remoteScreenShares.map(remoteScreenShare =>
|
const remoteScreenShareSourceNames = remoteScreenShares.map(remoteScreenShare =>
|
||||||
getTrackSourceNameByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, remoteScreenShare)
|
getTrackSourceNameByFakeScreenShareParticipant(tracks, remoteScreenShare)
|
||||||
);
|
);
|
||||||
|
|
||||||
receiverConstraints.selectedSources = remoteScreenShareSourceNames;
|
receiverConstraints.selectedSources = remoteScreenShareSourceNames;
|
||||||
|
|
Loading…
Reference in New Issue