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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* of JitsiLocalTrack or JitsiRemoteTrack.
|
||||
|
|
|
@ -10,14 +10,14 @@ import { setRemoteParticipantsWithScreenShare, fakeScreenshareParticipantsUpdate
|
|||
import { getAutoPinSetting, updateAutoPinnedParticipant } from './functions';
|
||||
|
||||
StateListenerRegistry.register(
|
||||
/* selector */ state => [ ...state['features/base/participants'].sortedFakeScreenShareParticipants ],
|
||||
/* selector */ state => state['features/base/participants'].sortedFakeScreenShareParticipants,
|
||||
/* listener */ (sortedFakeScreenShareParticipants, store) => {
|
||||
if (!getAutoPinSetting() || isFollowMeActive(store) || !getSourceNameSignalingFeatureFlag(store.getState())) {
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
// 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 { getLocalParticipant, getParticipantCount } from '../base/participants';
|
||||
import { StateListenerRegistry } from '../base/redux';
|
||||
import { getTrackSourceNameByMediaTypeAndParticipant } from '../base/tracks';
|
||||
import {
|
||||
getTrackSourceNameByFakeScreenShareParticipant,
|
||||
getTrackSourceNameByMediaTypeAndParticipant
|
||||
} from '../base/tracks';
|
||||
import { reportError } from '../base/util';
|
||||
import {
|
||||
getVideoQualityForLargeVideo,
|
||||
|
@ -235,7 +238,13 @@ function _updateReceiverVideoConstraints({ getState }) {
|
|||
|
||||
if (visibleRemoteParticipants?.size) {
|
||||
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) {
|
||||
visibleRemoteTrackSourceNames.push(sourceName);
|
||||
|
@ -244,9 +253,8 @@ function _updateReceiverVideoConstraints({ getState }) {
|
|||
}
|
||||
|
||||
if (localParticipantId !== largeVideoParticipantId) {
|
||||
largeVideoSourceName = getTrackSourceNameByMediaTypeAndParticipant(
|
||||
tracks, MEDIA_TYPE.VIDEO,
|
||||
largeVideoParticipantId
|
||||
largeVideoSourceName = getTrackSourceNameByFakeScreenShareParticipant(
|
||||
tracks, largeVideoParticipantId
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -263,7 +271,7 @@ function _updateReceiverVideoConstraints({ getState }) {
|
|||
// Prioritize screenshare in tile view.
|
||||
if (remoteScreenShares?.length) {
|
||||
const remoteScreenShareSourceNames = remoteScreenShares.map(remoteScreenShare =>
|
||||
getTrackSourceNameByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, remoteScreenShare)
|
||||
getTrackSourceNameByFakeScreenShareParticipant(tracks, remoteScreenShare)
|
||||
);
|
||||
|
||||
receiverConstraints.selectedSources = remoteScreenShareSourceNames;
|
||||
|
|
Loading…
Reference in New Issue