ref(multi-stream) Use helper function to get the video track.

This commit is contained in:
Jaya Allamsetty 2022-05-19 16:25:35 -04:00
parent a707022d0b
commit f5004a2a0c
3 changed files with 8 additions and 30 deletions

View File

@ -5,17 +5,13 @@ import { Text, View } from 'react-native';
import { SharedVideo } from '../../../shared-video/components/native';
import { Avatar } from '../../avatar';
import { getMultipleVideoSupportFeatureFlag } from '../../config/';
import { translate } from '../../i18n';
import { JitsiParticipantConnectionStatus } from '../../lib-jitsi-meet';
import {
MEDIA_TYPE,
VideoTrack
} from '../../media';
import { VideoTrack } from '../../media';
import { Container, TintedView } from '../../react';
import { connect } from '../../redux';
import { TestHint } from '../../testing/components';
import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../../tracks';
import { getVideoTrackByParticipant } from '../../tracks';
import { shouldRenderParticipantVideo, getParticipantById } from '../functions';
import styles from './styles';
@ -253,11 +249,9 @@ function _mapStateToProps(state, ownProps) {
const { disableVideo, participantId } = ownProps;
const participant = getParticipantById(state, participantId);
const tracks = state['features/base/tracks'];
const videoTrack = getVideoTrackByParticipant(tracks, participant);
let connectionStatus;
let participantName;
const videoTrack = getMultipleVideoSupportFeatureFlag(state) && participant?.isVirtualScreenshareParticipant
? getVirtualScreenshareParticipantTrack(tracks, participantId)
: getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, participantId);
return {
_connectionStatus:

View File

@ -8,13 +8,9 @@ import { isStageFilmstripAvailable } from '../../filmstrip/functions';
import { GRAVATAR_BASE_URL, isCORSAvatarURL } from '../avatar';
import { getMultipleVideoSupportFeatureFlag, getSourceNameSignalingFeatureFlag } from '../config';
import { JitsiParticipantConnectionStatus } from '../lib-jitsi-meet';
import { MEDIA_TYPE, shouldRenderVideoTrack } from '../media';
import { shouldRenderVideoTrack } from '../media';
import { toState } from '../redux';
import {
getScreenShareTrack,
getTrackByMediaTypeAndParticipant,
getVirtualScreenshareParticipantTrack
} from '../tracks';
import { getScreenShareTrack, getVideoTrackByParticipant } from '../tracks';
import { createDeferred } from '../util';
import { JIGASI_PARTICIPANT_ICON, MAX_DISPLAY_NAME_LENGTH, PARTICIPANT_ROLE } from './constants';
@ -482,14 +478,7 @@ export function shouldRenderParticipantVideo(stateful: Object | Function, id: st
}
/* First check if we have an unmuted video track. */
const tracks = state['features/base/tracks'];
let videoTrack;
if (getMultipleVideoSupportFeatureFlag(state) && participant.isVirtualScreenshareParticipant) {
videoTrack = getVirtualScreenshareParticipantTrack(tracks, id);
} else {
videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, id);
}
const videoTrack = getVideoTrackByParticipant(state['features/base/tracks'], participant);
if (!shouldRenderVideoTrack(videoTrack, /* waitForVideoStarted */ false)) {
return false;

View File

@ -2,13 +2,11 @@
import React, { Component } from 'react';
import { getMultipleVideoSupportFeatureFlag } from '../../../base/config';
import { MEDIA_TYPE } from '../../../base/media';
import { getParticipantByIdOrUndefined, PARTICIPANT_ROLE } from '../../../base/participants';
import { connect } from '../../../base/redux';
import {
getTrackByMediaTypeAndParticipant,
getVirtualScreenshareParticipantTrack,
getVideoTrackByParticipant,
isLocalTrackMuted,
isRemoteTrackMuted
} from '../../../base/tracks';
@ -100,7 +98,6 @@ function _mapStateToProps(state, ownProps) {
// Only the local participant won't have id for the time when the conference is not yet joined.
const participant = getParticipantByIdOrUndefined(state, participantID);
const tracks = state['features/base/tracks'];
const isMultiStreamSupportEnabled = getMultipleVideoSupportFeatureFlag(state);
let isAudioMuted = true;
let isScreenSharing = false;
@ -108,9 +105,7 @@ function _mapStateToProps(state, ownProps) {
if (participant?.local) {
isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
} else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
const track = isMultiStreamSupportEnabled && participant?.isVirtualScreenshareParticipant
? getVirtualScreenshareParticipantTrack(tracks, participantID)
: getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, participantID);
const track = getVideoTrackByParticipant(tracks, participant);
isScreenSharing = track?.videoType === 'desktop';
isAudioMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.AUDIO, participantID);