2019-07-02 13:06:52 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import VideoLayout from '../../../modules/UI/videolayout/VideoLayout';
|
2022-09-07 21:23:05 +00:00
|
|
|
import { getMultipleVideoSupportFeatureFlag } from '../base/config';
|
|
|
|
import { MEDIA_TYPE } from '../base/media';
|
2022-10-06 11:12:57 +00:00
|
|
|
import { isScreenShareParticipant } from '../base/participants';
|
2020-05-20 10:57:03 +00:00
|
|
|
import { StateListenerRegistry } from '../base/redux';
|
2022-09-07 21:23:05 +00:00
|
|
|
import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../base/tracks';
|
|
|
|
|
|
|
|
import { getLargeVideoParticipant } from './functions';
|
2019-07-02 13:06:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the on stage participant video.
|
|
|
|
*/
|
|
|
|
StateListenerRegistry.register(
|
|
|
|
/* selector */ state => state['features/large-video'].participantId,
|
|
|
|
/* listener */ participantId => {
|
|
|
|
VideoLayout.updateLargeVideo(participantId, true);
|
|
|
|
}
|
|
|
|
);
|
2022-09-07 21:23:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Schedules a large video update when the streaming status of the track associated with the large video changes.
|
|
|
|
*/
|
|
|
|
StateListenerRegistry.register(
|
|
|
|
/* selector */ state => {
|
|
|
|
const largeVideoParticipant = getLargeVideoParticipant(state);
|
|
|
|
const tracks = state['features/base/tracks'];
|
|
|
|
let videoTrack;
|
|
|
|
|
2022-10-06 11:12:57 +00:00
|
|
|
if (getMultipleVideoSupportFeatureFlag(state) && isScreenShareParticipant(largeVideoParticipant)) {
|
2022-09-07 21:23:05 +00:00
|
|
|
videoTrack = getVirtualScreenshareParticipantTrack(tracks, largeVideoParticipant?.id);
|
|
|
|
} else {
|
|
|
|
videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, largeVideoParticipant?.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
participantId: largeVideoParticipant?.id,
|
|
|
|
streamingStatus: videoTrack?.streamingStatus
|
|
|
|
};
|
|
|
|
},
|
|
|
|
/* listener */ ({ participantId, streamingStatus }, previousState = {}) => {
|
|
|
|
if (streamingStatus !== previousState.streamingStatus) {
|
|
|
|
VideoLayout.updateLargeVideo(participantId, true);
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
deepEquals: true
|
|
|
|
}
|
|
|
|
);
|