2018-09-13 15:20:22 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-08-20 23:32:38 +00:00
|
|
|
import React, { PureComponent } from 'react';
|
2022-03-30 13:54:03 +00:00
|
|
|
import { Image, View } from 'react-native';
|
2019-03-19 15:42:25 +00:00
|
|
|
import type { Dispatch } from 'redux';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2022-05-25 01:37:08 +00:00
|
|
|
import { getMultipleVideoSupportFeatureFlag, getSourceNameSignalingFeatureFlag } from '../../../base/config';
|
|
|
|
import { JitsiTrackEvents } from '../../../base/lib-jitsi-meet';
|
2019-09-13 10:00:08 +00:00
|
|
|
import { MEDIA_TYPE, VIDEO_TYPE } from '../../../base/media';
|
2017-02-27 20:37:53 +00:00
|
|
|
import {
|
|
|
|
PARTICIPANT_ROLE,
|
|
|
|
ParticipantView,
|
2019-09-12 13:03:20 +00:00
|
|
|
getParticipantCount,
|
2019-05-22 10:00:17 +00:00
|
|
|
isEveryoneModerator,
|
2021-07-09 12:36:19 +00:00
|
|
|
pinParticipant,
|
2021-08-04 08:51:05 +00:00
|
|
|
getParticipantByIdOrUndefined,
|
2021-12-20 08:44:22 +00:00
|
|
|
getLocalParticipant,
|
|
|
|
hasRaisedHand
|
2018-05-10 23:01:55 +00:00
|
|
|
} from '../../../base/participants';
|
|
|
|
import { Container } from '../../../base/react';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2022-05-25 01:37:08 +00:00
|
|
|
import {
|
|
|
|
getTrackByMediaTypeAndParticipant,
|
|
|
|
getVideoTrackByParticipant,
|
|
|
|
trackStreamingStatusChanged
|
|
|
|
} from '../../../base/tracks';
|
2019-04-15 16:23:28 +00:00
|
|
|
import { ConnectionIndicator } from '../../../connection-indicator';
|
2019-04-11 10:04:50 +00:00
|
|
|
import { DisplayNameLabel } from '../../../display-name';
|
2022-03-30 13:54:03 +00:00
|
|
|
import { getGifDisplayMode, getGifForParticipant } from '../../../gifs/functions';
|
2022-01-07 14:12:27 +00:00
|
|
|
import {
|
|
|
|
showContextMenuDetails,
|
|
|
|
showSharedVideoMenu
|
|
|
|
} from '../../../participants-pane/actions.native';
|
2020-07-24 12:14:33 +00:00
|
|
|
import { toggleToolboxVisible } from '../../../toolbox/actions.native';
|
2021-08-20 23:32:38 +00:00
|
|
|
import { SQUARE_TILE_ASPECT_RATIO } from '../../constants';
|
2018-12-19 18:40:17 +00:00
|
|
|
|
2018-05-10 23:01:55 +00:00
|
|
|
import AudioMutedIndicator from './AudioMutedIndicator';
|
|
|
|
import ModeratorIndicator from './ModeratorIndicator';
|
2022-03-31 11:39:49 +00:00
|
|
|
import PinnedIndicator from './PinnedIndicator';
|
2019-03-27 10:23:41 +00:00
|
|
|
import RaisedHandIndicator from './RaisedHandIndicator';
|
2020-07-16 15:03:15 +00:00
|
|
|
import ScreenShareIndicator from './ScreenShareIndicator';
|
2020-05-20 10:57:03 +00:00
|
|
|
import styles, { AVATAR_SIZE } from './styles';
|
2018-02-05 10:57:40 +00:00
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
/**
|
2018-09-13 15:20:22 +00:00
|
|
|
* Thumbnail component's property types.
|
2016-10-05 14:36:59 +00:00
|
|
|
*/
|
2018-09-13 15:20:22 +00:00
|
|
|
type Props = {
|
|
|
|
|
2016-12-01 01:52:39 +00:00
|
|
|
/**
|
2019-09-13 10:00:08 +00:00
|
|
|
* Whether local audio (microphone) is muted or not.
|
2018-09-13 15:20:22 +00:00
|
|
|
*/
|
2019-09-13 10:00:08 +00:00
|
|
|
_audioMuted: boolean,
|
2018-09-13 15:20:22 +00:00
|
|
|
|
2022-03-30 13:54:03 +00:00
|
|
|
/**
|
|
|
|
* URL of GIF sent by this participant, null if there's none.
|
|
|
|
*/
|
|
|
|
_gifSrc: ?string,
|
|
|
|
|
2018-09-13 15:20:22 +00:00
|
|
|
/**
|
2021-08-20 23:32:38 +00:00
|
|
|
* Indicates whether the participant is fake.
|
2018-09-13 15:20:22 +00:00
|
|
|
*/
|
2021-08-20 23:32:38 +00:00
|
|
|
_isFakeParticipant: boolean,
|
|
|
|
|
2022-05-19 18:52:08 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether multi-stream support is enabled.
|
|
|
|
*/
|
|
|
|
_isMultiStreamSupportEnabled: boolean,
|
|
|
|
|
2021-08-20 23:32:38 +00:00
|
|
|
/**
|
2021-08-26 23:23:38 +00:00
|
|
|
* Indicates whether the participant is screen sharing.
|
2021-08-20 23:32:38 +00:00
|
|
|
*/
|
|
|
|
_isScreenShare: boolean,
|
|
|
|
|
2022-05-19 18:52:08 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether the thumbnail is for a virtual screenshare participant.
|
|
|
|
*/
|
|
|
|
_isVirtualScreenshare: boolean,
|
|
|
|
|
2021-08-20 23:32:38 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether the participant is local.
|
|
|
|
*/
|
|
|
|
_local: boolean,
|
2018-09-13 15:20:22 +00:00
|
|
|
|
2021-08-04 08:51:05 +00:00
|
|
|
/**
|
|
|
|
* Shared video local participant owner.
|
|
|
|
*/
|
|
|
|
_localVideoOwner: boolean,
|
|
|
|
|
2019-01-05 16:49:21 +00:00
|
|
|
/**
|
2021-08-20 23:32:38 +00:00
|
|
|
* The ID of the participant obtain from the participant object in Redux.
|
|
|
|
*
|
|
|
|
* NOTE: Generally it should be the same as the participantID prop except the case where the passed
|
2022-07-14 07:10:08 +00:00
|
|
|
* participantID doesn't correspond to any of the existing participants.
|
2021-08-20 23:32:38 +00:00
|
|
|
*/
|
|
|
|
_participantId: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether the participant is pinned or not.
|
2019-01-05 16:49:21 +00:00
|
|
|
*/
|
2021-08-20 23:32:38 +00:00
|
|
|
_pinned: boolean,
|
2019-01-05 16:49:21 +00:00
|
|
|
|
2021-12-20 08:44:22 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the participant has the hand raised.
|
|
|
|
*/
|
|
|
|
_raisedHand: boolean,
|
|
|
|
|
2019-09-12 13:03:20 +00:00
|
|
|
/**
|
|
|
|
* Whether to show the dominant speaker indicator or not.
|
|
|
|
*/
|
2019-09-13 09:51:49 +00:00
|
|
|
_renderDominantSpeakerIndicator: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to show the moderator indicator or not.
|
|
|
|
*/
|
|
|
|
_renderModeratorIndicator: boolean,
|
2019-09-12 13:03:20 +00:00
|
|
|
|
2022-05-25 01:37:08 +00:00
|
|
|
/**
|
|
|
|
* Whether source name signaling is enabled.
|
|
|
|
*/
|
|
|
|
_sourceNameSignalingEnabled: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The video track that will be displayed in the thumbnail.
|
|
|
|
*/
|
|
|
|
_videoTrack: ?Object,
|
|
|
|
|
2018-09-13 15:20:22 +00:00
|
|
|
/**
|
|
|
|
* Invoked to trigger state changes in Redux.
|
|
|
|
*/
|
2019-03-19 15:42:25 +00:00
|
|
|
dispatch: Dispatch<any>,
|
2018-09-13 15:20:22 +00:00
|
|
|
|
2021-08-20 23:32:38 +00:00
|
|
|
/**
|
|
|
|
* The height of the thumnail.
|
|
|
|
*/
|
|
|
|
height: ?number,
|
|
|
|
|
2018-09-13 15:20:22 +00:00
|
|
|
/**
|
2021-07-09 12:36:19 +00:00
|
|
|
* The ID of the participant related to the thumbnail.
|
2018-09-13 15:20:22 +00:00
|
|
|
*/
|
2021-07-09 12:36:19 +00:00
|
|
|
participantID: ?string,
|
2018-09-13 15:20:22 +00:00
|
|
|
|
2019-04-11 10:04:50 +00:00
|
|
|
/**
|
|
|
|
* Whether to display or hide the display name of the participant in the thumbnail.
|
|
|
|
*/
|
|
|
|
renderDisplayName: ?boolean,
|
|
|
|
|
2019-06-19 12:44:39 +00:00
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* If true, it tells the thumbnail that it needs to behave differently. E.g. React differently to a single tap.
|
2019-06-19 12:44:39 +00:00
|
|
|
*/
|
|
|
|
tileView?: boolean
|
2018-09-13 15:20:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* React component for video thumbnail.
|
|
|
|
*/
|
2021-08-20 23:32:38 +00:00
|
|
|
class Thumbnail extends PureComponent<Props> {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates new Thumbnail component.
|
|
|
|
*
|
|
|
|
* @param {Props} props - The props of the component.
|
|
|
|
* @returns {Thumbnail}
|
|
|
|
*/
|
|
|
|
constructor(props: Props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this._onClick = this._onClick.bind(this);
|
|
|
|
this._onThumbnailLongPress = this._onThumbnailLongPress.bind(this);
|
2022-05-25 01:37:08 +00:00
|
|
|
this.handleTrackStreamingStatusChanged = this.handleTrackStreamingStatusChanged.bind(this);
|
2021-08-23 23:02:41 +00:00
|
|
|
}
|
|
|
|
|
2021-08-20 23:32:38 +00:00
|
|
|
_onClick: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Thumbnail click handler.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onClick() {
|
|
|
|
const { _participantId, _pinned, dispatch, tileView } = this.props;
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
if (tileView) {
|
|
|
|
dispatch(toggleToolboxVisible());
|
|
|
|
} else {
|
2021-08-20 23:32:38 +00:00
|
|
|
dispatch(pinParticipant(_pinned ? null : _participantId));
|
2021-07-09 12:36:19 +00:00
|
|
|
}
|
2021-08-20 23:32:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_onThumbnailLongPress: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Thumbnail long press handler.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onThumbnailLongPress() {
|
|
|
|
const { _participantId, _local, _isFakeParticipant, _localVideoOwner, dispatch } = this.props;
|
|
|
|
|
2022-01-07 14:12:27 +00:00
|
|
|
if (_isFakeParticipant && _localVideoOwner) {
|
|
|
|
dispatch(showSharedVideoMenu(_participantId));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_isFakeParticipant) {
|
2022-01-28 10:47:54 +00:00
|
|
|
dispatch(showContextMenuDetails(_participantId, _local));
|
2021-07-09 12:36:19 +00:00
|
|
|
}
|
2021-08-20 23:32:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-08-26 23:23:38 +00:00
|
|
|
* Renders the indicators for the thumbnail.
|
2021-08-20 23:32:38 +00:00
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
2021-08-26 23:23:38 +00:00
|
|
|
_renderIndicators() {
|
2021-08-20 23:32:38 +00:00
|
|
|
const {
|
|
|
|
_audioMuted: audioMuted,
|
2022-06-01 20:13:27 +00:00
|
|
|
_isMultiStreamSupportEnabled,
|
2021-08-20 23:32:38 +00:00
|
|
|
_isScreenShare: isScreenShare,
|
2022-05-19 18:52:08 +00:00
|
|
|
_isVirtualScreenshare,
|
2021-08-20 23:32:38 +00:00
|
|
|
_isFakeParticipant,
|
|
|
|
_renderModeratorIndicator: renderModeratorIndicator,
|
|
|
|
_participantId: participantId,
|
2022-03-31 11:39:49 +00:00
|
|
|
_pinned,
|
|
|
|
renderDisplayName,
|
|
|
|
tileView
|
2021-08-26 23:23:38 +00:00
|
|
|
} = this.props;
|
|
|
|
const indicators = [];
|
|
|
|
|
|
|
|
if (!_isFakeParticipant) {
|
|
|
|
indicators.push(<View
|
2021-09-01 11:04:51 +00:00
|
|
|
key = 'top-left-indicators'
|
2021-08-26 23:23:38 +00:00
|
|
|
style = { [
|
|
|
|
styles.thumbnailTopIndicatorContainer,
|
|
|
|
styles.thumbnailTopLeftIndicatorContainer
|
|
|
|
] }>
|
2022-05-19 18:52:08 +00:00
|
|
|
{ !_isVirtualScreenshare && <ConnectionIndicator participantId = { participantId } /> }
|
|
|
|
{ !_isVirtualScreenshare && <RaisedHandIndicator participantId = { participantId } /> }
|
2022-03-31 11:39:49 +00:00
|
|
|
{tileView && isScreenShare && (
|
2022-02-14 10:13:18 +00:00
|
|
|
<View style = { styles.indicatorContainer }>
|
|
|
|
<ScreenShareIndicator />
|
|
|
|
</View>
|
|
|
|
)}
|
2021-08-26 23:23:38 +00:00
|
|
|
</View>);
|
2021-09-01 11:04:51 +00:00
|
|
|
indicators.push(<Container
|
|
|
|
key = 'bottom-indicators'
|
|
|
|
style = { styles.thumbnailIndicatorContainer }>
|
2022-02-24 12:17:02 +00:00
|
|
|
<Container style = { (audioMuted || renderModeratorIndicator) && styles.bottomIndicatorsContainer }>
|
2022-05-19 18:52:08 +00:00
|
|
|
{ audioMuted && !_isVirtualScreenshare && <AudioMutedIndicator /> }
|
2022-03-31 11:39:49 +00:00
|
|
|
{ !tileView && _pinned && <PinnedIndicator />}
|
2022-05-19 18:52:08 +00:00
|
|
|
{ renderModeratorIndicator && !_isVirtualScreenshare && <ModeratorIndicator />}
|
2022-06-01 20:13:27 +00:00
|
|
|
{ !tileView && ((isScreenShare && !_isMultiStreamSupportEnabled) || _isVirtualScreenshare)
|
|
|
|
&& <ScreenShareIndicator /> /* Do not show screensharing indicator on the local camera
|
|
|
|
thumbnail when a virtual SS participant tile is created for local screenshare */
|
2022-03-31 11:39:49 +00:00
|
|
|
}
|
2022-02-24 12:17:02 +00:00
|
|
|
</Container>
|
2022-02-23 13:46:38 +00:00
|
|
|
{
|
|
|
|
renderDisplayName && <DisplayNameLabel
|
|
|
|
contained = { true }
|
|
|
|
participantId = { participantId } />
|
|
|
|
}
|
2021-08-26 23:23:38 +00:00
|
|
|
</Container>);
|
|
|
|
}
|
|
|
|
|
|
|
|
return indicators;
|
|
|
|
}
|
|
|
|
|
2022-05-25 01:37:08 +00:00
|
|
|
/**
|
|
|
|
* Starts listening for track streaming status updates after the initial render.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentDidMount() {
|
|
|
|
// Listen to track streaming status changed event to keep it updated.
|
|
|
|
// TODO: after converting this component to a react function component,
|
|
|
|
// use a custom hook to update local track streaming status.
|
|
|
|
const { _videoTrack, dispatch, _sourceNameSignalingEnabled } = this.props;
|
|
|
|
|
|
|
|
if (_sourceNameSignalingEnabled && _videoTrack && !_videoTrack.local) {
|
|
|
|
_videoTrack.jitsiTrack.on(JitsiTrackEvents.TRACK_STREAMING_STATUS_CHANGED,
|
|
|
|
this.handleTrackStreamingStatusChanged);
|
|
|
|
dispatch(trackStreamingStatusChanged(_videoTrack.jitsiTrack,
|
|
|
|
_videoTrack.jitsiTrack.getTrackStreamingStatus()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stops listening for track streaming status updates on the old track and starts listening instead on the new
|
|
|
|
* track.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentDidUpdate(prevProps: Props) {
|
|
|
|
// TODO: after converting this component to a react function component,
|
|
|
|
// use a custom hook to update local track streaming status.
|
|
|
|
const { _videoTrack, dispatch, _sourceNameSignalingEnabled } = this.props;
|
|
|
|
|
|
|
|
if (_sourceNameSignalingEnabled
|
|
|
|
&& prevProps._videoTrack?.jitsiTrack?.getSourceName() !== _videoTrack?.jitsiTrack?.getSourceName()) {
|
|
|
|
if (prevProps._videoTrack && !prevProps._videoTrack.local) {
|
|
|
|
prevProps._videoTrack.jitsiTrack.off(JitsiTrackEvents.TRACK_STREAMING_STATUS_CHANGED,
|
|
|
|
this.handleTrackStreamingStatusChanged);
|
|
|
|
dispatch(trackStreamingStatusChanged(prevProps._videoTrack.jitsiTrack,
|
|
|
|
prevProps._videoTrack.jitsiTrack.getTrackStreamingStatus()));
|
|
|
|
}
|
|
|
|
if (_videoTrack && !_videoTrack.local) {
|
|
|
|
_videoTrack.jitsiTrack.on(JitsiTrackEvents.TRACK_STREAMING_STATUS_CHANGED,
|
|
|
|
this.handleTrackStreamingStatusChanged);
|
|
|
|
dispatch(trackStreamingStatusChanged(_videoTrack.jitsiTrack,
|
|
|
|
_videoTrack.jitsiTrack.getTrackStreamingStatus()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove listeners for track streaming status update.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentWillUnmount() {
|
|
|
|
// TODO: after converting this component to a react function component,
|
|
|
|
// use a custom hook to update local track streaming status.
|
|
|
|
const { _videoTrack, dispatch, _sourceNameSignalingEnabled } = this.props;
|
|
|
|
|
|
|
|
if (_sourceNameSignalingEnabled && _videoTrack && !_videoTrack.local) {
|
|
|
|
_videoTrack.jitsiTrack.off(JitsiTrackEvents.TRACK_STREAMING_STATUS_CHANGED,
|
|
|
|
this.handleTrackStreamingStatusChanged);
|
|
|
|
dispatch(trackStreamingStatusChanged(_videoTrack.jitsiTrack,
|
|
|
|
_videoTrack.jitsiTrack.getTrackStreamingStatus()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle track streaming status change event by by dispatching an action to update track streaming status for the
|
|
|
|
* given track in app state.
|
|
|
|
*
|
|
|
|
* @param {JitsiTrack} jitsiTrack - The track with streaming status updated.
|
|
|
|
* @param {JitsiTrackStreamingStatus} streamingStatus - The updated track streaming status.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
handleTrackStreamingStatusChanged(jitsiTrack, streamingStatus) {
|
|
|
|
this.props.dispatch(trackStreamingStatusChanged(jitsiTrack, streamingStatus));
|
|
|
|
}
|
|
|
|
|
2021-08-26 23:23:38 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
const {
|
2022-03-30 13:54:03 +00:00
|
|
|
_gifSrc,
|
2021-08-26 23:23:38 +00:00
|
|
|
_isFakeParticipant,
|
2022-05-19 18:52:08 +00:00
|
|
|
_isScreenShare: isScreenShare,
|
|
|
|
_isVirtualScreenshare,
|
2021-08-26 23:23:38 +00:00
|
|
|
_participantId: participantId,
|
2021-12-20 08:44:22 +00:00
|
|
|
_raisedHand,
|
2022-02-14 10:13:18 +00:00
|
|
|
_renderDominantSpeakerIndicator,
|
2021-08-20 23:32:38 +00:00
|
|
|
height,
|
|
|
|
tileView
|
|
|
|
} = this.props;
|
|
|
|
const styleOverrides = tileView ? {
|
|
|
|
aspectRatio: SQUARE_TILE_ASPECT_RATIO,
|
|
|
|
flex: 0,
|
|
|
|
height,
|
|
|
|
maxHeight: null,
|
|
|
|
maxWidth: null,
|
|
|
|
width: null
|
|
|
|
} : null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Container
|
|
|
|
onClick = { this._onClick }
|
|
|
|
onLongPress = { this._onThumbnailLongPress }
|
2019-09-13 10:06:02 +00:00
|
|
|
style = { [
|
2021-08-20 23:32:38 +00:00
|
|
|
styles.thumbnail,
|
2021-12-20 08:44:22 +00:00
|
|
|
styleOverrides,
|
2022-05-19 18:52:08 +00:00
|
|
|
_raisedHand && !_isVirtualScreenshare ? styles.thumbnailRaisedHand : null,
|
|
|
|
_renderDominantSpeakerIndicator && !_isVirtualScreenshare ? styles.thumbnailDominantSpeaker : null
|
2021-08-20 23:32:38 +00:00
|
|
|
] }
|
|
|
|
touchFeedback = { false }>
|
2022-03-30 13:54:03 +00:00
|
|
|
{_gifSrc ? <Image
|
|
|
|
source = {{ uri: _gifSrc }}
|
|
|
|
style = { styles.thumbnailGif } />
|
|
|
|
: <>
|
|
|
|
<ParticipantView
|
|
|
|
avatarSize = { tileView ? AVATAR_SIZE * 1.5 : AVATAR_SIZE }
|
2022-05-25 01:37:08 +00:00
|
|
|
disableVideo = { (isScreenShare && !_isVirtualScreenshare) || _isFakeParticipant }
|
2022-03-30 13:54:03 +00:00
|
|
|
participantId = { participantId }
|
|
|
|
zOrder = { 1 } />
|
|
|
|
{
|
|
|
|
this._renderIndicators()
|
|
|
|
}
|
|
|
|
</>
|
2021-08-20 23:32:38 +00:00
|
|
|
}
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|
2019-01-05 16:49:21 +00:00
|
|
|
}
|
2017-01-28 23:28:13 +00:00
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
/**
|
|
|
|
* Function that maps parts of Redux state tree into component props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - Redux state.
|
2019-01-05 16:49:21 +00:00
|
|
|
* @param {Props} ownProps - Properties of component.
|
2019-09-12 13:03:20 +00:00
|
|
|
* @returns {Object}
|
2016-10-05 14:36:59 +00:00
|
|
|
*/
|
2017-01-28 23:34:57 +00:00
|
|
|
function _mapStateToProps(state, ownProps) {
|
2021-08-04 08:51:05 +00:00
|
|
|
const { ownerId } = state['features/shared-video'];
|
2016-10-05 14:36:59 +00:00
|
|
|
const tracks = state['features/base/tracks'];
|
2022-03-31 11:39:49 +00:00
|
|
|
const { participantID, tileView } = ownProps;
|
2021-07-09 12:36:19 +00:00
|
|
|
const participant = getParticipantByIdOrUndefined(state, participantID);
|
2021-08-04 08:51:05 +00:00
|
|
|
const localParticipantId = getLocalParticipant(state).id;
|
2021-07-09 12:36:19 +00:00
|
|
|
const id = participant?.id;
|
2022-05-19 18:52:08 +00:00
|
|
|
const audioTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.AUDIO, id);
|
2022-05-25 01:37:08 +00:00
|
|
|
const videoTrack = getVideoTrackByParticipant(tracks, participant);
|
2022-05-19 18:52:08 +00:00
|
|
|
const isMultiStreamSupportEnabled = getMultipleVideoSupportFeatureFlag(state);
|
2021-08-26 23:26:41 +00:00
|
|
|
const isScreenShare = videoTrack?.videoType === VIDEO_TYPE.DESKTOP;
|
2019-09-12 13:03:20 +00:00
|
|
|
const participantCount = getParticipantCount(state);
|
2021-07-09 12:36:19 +00:00
|
|
|
const renderDominantSpeakerIndicator = participant && participant.dominantSpeaker && participantCount > 2;
|
2019-09-13 09:51:49 +00:00
|
|
|
const _isEveryoneModerator = isEveryoneModerator(state);
|
2022-03-31 11:39:49 +00:00
|
|
|
const renderModeratorIndicator = tileView && !_isEveryoneModerator
|
2021-08-26 23:26:41 +00:00
|
|
|
&& participant?.role === PARTICIPANT_ROLE.MODERATOR;
|
2022-03-30 13:54:03 +00:00
|
|
|
const { gifUrl: gifSrc } = getGifForParticipant(state, id);
|
|
|
|
const mode = getGifDisplayMode(state);
|
2016-10-05 14:36:59 +00:00
|
|
|
|
|
|
|
return {
|
2019-09-13 10:00:08 +00:00
|
|
|
_audioMuted: audioTrack?.muted ?? true,
|
2022-03-30 13:54:03 +00:00
|
|
|
_gifSrc: mode === 'chat' ? null : gifSrc,
|
2021-08-20 23:32:38 +00:00
|
|
|
_isFakeParticipant: participant?.isFakeParticipant,
|
2022-05-19 18:52:08 +00:00
|
|
|
_isMultiStreamSupportEnabled: isMultiStreamSupportEnabled,
|
2021-08-30 14:50:24 +00:00
|
|
|
_isScreenShare: isScreenShare,
|
2022-05-19 18:52:08 +00:00
|
|
|
_isVirtualScreenshare: isMultiStreamSupportEnabled && participant?.isVirtualScreenshareParticipant,
|
2021-08-20 23:32:38 +00:00
|
|
|
_local: participant?.local,
|
2021-08-04 08:51:05 +00:00
|
|
|
_localVideoOwner: Boolean(ownerId === localParticipantId),
|
2021-08-20 23:32:38 +00:00
|
|
|
_participantId: id,
|
|
|
|
_pinned: participant?.pinned,
|
2021-12-20 08:44:22 +00:00
|
|
|
_raisedHand: hasRaisedHand(participant),
|
2019-09-13 09:51:49 +00:00
|
|
|
_renderDominantSpeakerIndicator: renderDominantSpeakerIndicator,
|
2022-05-25 01:37:08 +00:00
|
|
|
_renderModeratorIndicator: renderModeratorIndicator,
|
|
|
|
_sourceNameSignalingEnabled: getSourceNameSignalingFeatureFlag(state),
|
|
|
|
_videoTrack: videoTrack
|
2016-10-05 14:36:59 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
export default connect(_mapStateToProps)(Thumbnail);
|