2022-08-25 11:35:19 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2022-09-13 07:36:00 +00:00
|
|
|
import { Theme } from '@mui/material';
|
|
|
|
import { withStyles } from '@mui/styles';
|
2021-12-15 13:18:41 +00:00
|
|
|
import clsx from 'clsx';
|
2022-02-02 20:33:30 +00:00
|
|
|
import debounce from 'lodash/debounce';
|
2023-02-28 10:21:15 +00:00
|
|
|
import React, { Component, KeyboardEvent, RefObject, createRef } from 'react';
|
|
|
|
import { WithTranslation } from 'react-i18next';
|
2022-09-13 07:36:00 +00:00
|
|
|
import { connect } from 'react-redux';
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2022-09-07 08:20:05 +00:00
|
|
|
import { createScreenSharingIssueEvent } from '../../../analytics/AnalyticsEvents';
|
|
|
|
import { sendAnalytics } from '../../../analytics/functions';
|
2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState } from '../../../app/types';
|
2022-08-25 11:35:19 +00:00
|
|
|
// @ts-ignore
|
2020-11-09 20:59:13 +00:00
|
|
|
import { Avatar } from '../../../base/avatar';
|
2021-07-20 08:30:12 +00:00
|
|
|
import { isMobileBrowser } from '../../../base/environment/utils';
|
2023-02-28 10:21:15 +00:00
|
|
|
import { translate } from '../../../base/i18n/functions';
|
2022-04-26 20:33:50 +00:00
|
|
|
import { JitsiTrackEvents } from '../../../base/lib-jitsi-meet';
|
2022-08-25 11:35:19 +00:00
|
|
|
// @ts-ignore
|
2022-09-05 11:24:13 +00:00
|
|
|
import { VideoTrack } from '../../../base/media';
|
|
|
|
import { MEDIA_TYPE } from '../../../base/media/constants';
|
2022-08-25 11:35:19 +00:00
|
|
|
import { pinParticipant } from '../../../base/participants/actions';
|
2020-11-09 20:59:13 +00:00
|
|
|
import {
|
2022-04-12 06:57:01 +00:00
|
|
|
getLocalParticipant,
|
2021-07-09 12:36:19 +00:00
|
|
|
getParticipantByIdOrUndefined,
|
2022-10-06 11:12:57 +00:00
|
|
|
hasRaisedHand,
|
|
|
|
isLocalScreenshareParticipant,
|
|
|
|
isScreenShareParticipant,
|
|
|
|
isWhiteboardParticipant
|
2022-08-25 11:35:19 +00:00
|
|
|
} from '../../../base/participants/functions';
|
2022-10-20 09:11:27 +00:00
|
|
|
import { IParticipant } from '../../../base/participants/types';
|
2021-09-09 13:14:09 +00:00
|
|
|
import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
|
2022-10-11 10:47:54 +00:00
|
|
|
import { isTestModeEnabled } from '../../../base/testing/functions';
|
2023-02-28 10:21:15 +00:00
|
|
|
// @ts-ignore
|
|
|
|
import { Tooltip } from '../../../base/tooltip';
|
2022-10-11 10:47:54 +00:00
|
|
|
import { trackStreamingStatusChanged, updateLastTrackVideoMediaEvent } from '../../../base/tracks/actions';
|
2021-01-21 20:46:47 +00:00
|
|
|
import {
|
|
|
|
getLocalAudioTrack,
|
|
|
|
getTrackByMediaTypeAndParticipant,
|
2022-11-08 19:15:49 +00:00
|
|
|
getVideoTrackByParticipant
|
2022-10-11 10:47:54 +00:00
|
|
|
} from '../../../base/tracks/functions';
|
2022-04-06 09:10:31 +00:00
|
|
|
import { getVideoObjectPosition } from '../../../face-landmarks/functions';
|
2022-03-11 13:00:49 +00:00
|
|
|
import { hideGif, showGif } from '../../../gifs/actions';
|
|
|
|
import { getGifDisplayMode, getGifForParticipant } from '../../../gifs/functions';
|
2022-08-25 11:35:19 +00:00
|
|
|
// @ts-ignore
|
2020-11-09 20:59:13 +00:00
|
|
|
import { PresenceLabel } from '../../../presence-status';
|
2022-09-09 09:22:30 +00:00
|
|
|
import { LAYOUTS } from '../../../video-layout/constants';
|
2022-11-28 10:52:45 +00:00
|
|
|
import { getCurrentLayout } from '../../../video-layout/functions.web';
|
2022-04-12 06:57:01 +00:00
|
|
|
import { togglePinStageParticipant } from '../../actions';
|
2021-01-21 20:46:47 +00:00
|
|
|
import {
|
|
|
|
DISPLAY_MODE_TO_CLASS_NAME,
|
|
|
|
DISPLAY_VIDEO,
|
2022-06-29 13:59:49 +00:00
|
|
|
FILMSTRIP_TYPE,
|
2022-02-24 12:20:37 +00:00
|
|
|
SHOW_TOOLBAR_CONTEXT_MENU_AFTER,
|
2022-04-12 13:19:10 +00:00
|
|
|
THUMBNAIL_TYPE,
|
2022-02-24 12:20:37 +00:00
|
|
|
VIDEO_TEST_EVENTS
|
2021-01-21 20:46:47 +00:00
|
|
|
} from '../../constants';
|
2022-02-24 12:20:37 +00:00
|
|
|
import {
|
|
|
|
computeDisplayModeFromInput,
|
2022-03-29 08:45:09 +00:00
|
|
|
getActiveParticipantsIds,
|
2022-02-24 12:20:37 +00:00
|
|
|
getDisplayModeInput,
|
2022-04-21 06:15:34 +00:00
|
|
|
getThumbnailTypeFromLayout,
|
|
|
|
isStageFilmstripAvailable,
|
2022-09-27 07:10:28 +00:00
|
|
|
isVideoPlayable,
|
2022-04-21 06:15:34 +00:00
|
|
|
showGridInVerticalView
|
2022-02-24 12:20:37 +00:00
|
|
|
} from '../../functions';
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
// @ts-ignore
|
2021-12-15 13:18:41 +00:00
|
|
|
import ThumbnailAudioIndicator from './ThumbnailAudioIndicator';
|
|
|
|
import ThumbnailBottomIndicators from './ThumbnailBottomIndicators';
|
|
|
|
import ThumbnailTopIndicators from './ThumbnailTopIndicators';
|
2022-08-25 11:35:19 +00:00
|
|
|
// @ts-ignore
|
2022-04-29 14:32:16 +00:00
|
|
|
import VirtualScreenshareParticipant from './VirtualScreenshareParticipant';
|
2023-02-02 11:12:31 +00:00
|
|
|
/* eslint-enable lines-around-comment */
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} state of {@link Thumbnail}.
|
|
|
|
*/
|
2022-11-03 08:35:51 +00:00
|
|
|
export interface IState {
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the canplay event has been received.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
canPlayEventReceived: boolean;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current display mode of the thumbnail.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
displayMode: number;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
|
|
|
/**
|
2022-08-25 11:35:19 +00:00
|
|
|
* Indicates whether the thumbnail is hovered or not.
|
2021-01-21 20:46:47 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
isHovered: boolean;
|
2021-11-01 09:39:19 +00:00
|
|
|
|
|
|
|
/**
|
2022-08-25 11:35:19 +00:00
|
|
|
* Whether popover is visible or not.
|
2021-11-01 09:39:19 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
popoverVisible: boolean;
|
2022-11-03 08:35:51 +00:00
|
|
|
}
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link Thumbnail}.
|
|
|
|
*/
|
2023-02-28 10:21:15 +00:00
|
|
|
export interface IProps extends WithTranslation {
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The audio track related to the participant.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_audioTrack?: Object;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether the local video flip feature is disabled or not.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_disableLocalVideoFlip: boolean;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2021-12-01 10:40:40 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether enlargement of tiles to fill the available space is disabled.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_disableTileEnlargement: boolean;
|
2021-12-01 10:40:40 +00:00
|
|
|
|
2022-03-11 13:00:49 +00:00
|
|
|
/**
|
|
|
|
* URL of GIF sent by this participant, null if there's none.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_gifSrc?: string;
|
2022-03-11 13:00:49 +00:00
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* The height of the Thumbnail.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_height: number;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
/**
|
2022-03-29 08:45:09 +00:00
|
|
|
* Whether or not the participant is displayed on the stage filmstrip.
|
|
|
|
* Used to hide the video from the vertical filmstrip.
|
2020-11-09 20:59:13 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isActiveParticipant: boolean;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether audio only mode is enabled.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isAudioOnly: boolean;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether the participant associated with the thumbnail is displayed on the large video.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isCurrentlyOnLargeVideo: boolean;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2022-04-04 18:57:58 +00:00
|
|
|
/**
|
2022-05-12 22:47:38 +00:00
|
|
|
* Disable/enable the dominant speaker indicator.
|
2022-04-04 18:57:58 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isDominantSpeakerDisabled: boolean;
|
2022-04-04 18:57:58 +00:00
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether the thumbnail should be hidden or not.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isHidden: boolean;
|
2022-08-25 11:35:19 +00:00
|
|
|
|
2021-07-20 08:30:12 +00:00
|
|
|
/**
|
|
|
|
* Whether we are currently running in a mobile browser.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isMobile: boolean;
|
2021-07-20 08:30:12 +00:00
|
|
|
|
2021-09-09 13:14:09 +00:00
|
|
|
/**
|
|
|
|
* Whether we are currently running in a mobile browser in portrait orientation.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isMobilePortrait: boolean;
|
2021-09-09 13:14:09 +00:00
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether the participant is screen sharing.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isScreenSharing: boolean;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
|
|
|
/**
|
2022-05-12 22:47:38 +00:00
|
|
|
* Indicates whether testing mode is enabled.
|
2021-01-21 20:46:47 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isTestModeEnabled: boolean;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
/**
|
2022-05-12 22:47:38 +00:00
|
|
|
* Indicates whether the video associated with the thumbnail is playable.
|
2020-11-09 20:59:13 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isVideoPlayable: boolean;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
2022-05-12 22:47:38 +00:00
|
|
|
* Indicates whether the participant is a virtual screen share participant. This prop is behind the
|
|
|
|
* sourceNameSignaling feature flag.
|
2021-01-21 20:46:47 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_isVirtualScreenshareParticipant: boolean;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current local video flip setting.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_localFlipX: boolean;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
/**
|
2021-10-22 12:35:33 +00:00
|
|
|
* An object with information about the participant related to the thumbnail.
|
2020-11-09 20:59:13 +00:00
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
_participant: IParticipant;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2021-12-20 08:44:22 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the participant has the hand raised.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_raisedHand: boolean;
|
2021-12-20 08:44:22 +00:00
|
|
|
|
2022-11-21 09:03:03 +00:00
|
|
|
/**
|
|
|
|
* Whether or not to display a tint background over tile.
|
|
|
|
*/
|
|
|
|
_shouldDisplayTintBackground: boolean;
|
|
|
|
|
2022-03-29 08:45:09 +00:00
|
|
|
/**
|
2022-04-12 13:19:10 +00:00
|
|
|
* Whether or not the current layout is stage filmstrip layout.
|
2022-03-29 08:45:09 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_stageFilmstripLayout: boolean;
|
2022-03-29 08:45:09 +00:00
|
|
|
|
2022-04-12 06:57:01 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the participants are displayed on stage.
|
|
|
|
* (and not screensharing or shared video; used to determine
|
|
|
|
* whether or not the display the participant video in the vertical filmstrip).
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_stageParticipantsVisible: boolean;
|
2022-04-12 06:57:01 +00:00
|
|
|
|
2022-04-12 13:19:10 +00:00
|
|
|
/**
|
|
|
|
* The type of thumbnail to display.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_thumbnailType: string;
|
2022-04-12 13:19:10 +00:00
|
|
|
|
2022-03-02 12:39:50 +00:00
|
|
|
/**
|
|
|
|
* The video object position for the participant.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_videoObjectPosition: string;
|
2022-03-02 12:39:50 +00:00
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* The video track that will be displayed in the thumbnail.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_videoTrack?: any;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The width of the thumbnail.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_width: number;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
/**
|
2022-03-11 13:00:49 +00:00
|
|
|
* An object containing CSS classes.
|
2020-11-09 20:59:13 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
classes: any;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
/**
|
2022-03-11 13:00:49 +00:00
|
|
|
* The redux dispatch function.
|
2021-12-15 13:18:41 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
dispatch: Function;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
2022-06-29 13:59:49 +00:00
|
|
|
/**
|
|
|
|
* The type of filmstrip the tile is displayed in.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
filmstripType: string;
|
2022-06-29 13:59:49 +00:00
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
/**
|
|
|
|
* The horizontal offset in px for the thumbnail. Used to center the thumbnails from the last row in tile view.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
horizontalOffset: number;
|
2021-03-26 20:23:05 +00:00
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* The ID of the participant related to the thumbnail.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
participantID?: string;
|
2021-03-26 20:23:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Styles that will be set to the Thumbnail's main span element.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
style?: any;
|
2022-04-26 20:33:50 +00:00
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
/**
|
2022-05-03 21:55:33 +00:00
|
|
|
* The width of the thumbnail. Used for expanding the width of the thumbnails on last row in case
|
|
|
|
* there is empty space.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
width?: number;
|
2022-11-03 08:35:51 +00:00
|
|
|
}
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2022-09-13 07:36:00 +00:00
|
|
|
const defaultStyles = (theme: Theme) => {
|
2021-12-15 13:18:41 +00:00
|
|
|
return {
|
|
|
|
indicatorsContainer: {
|
2022-09-13 07:36:00 +00:00
|
|
|
position: 'absolute' as const,
|
|
|
|
padding: theme.spacing(1),
|
2021-12-15 13:18:41 +00:00
|
|
|
zIndex: 10,
|
|
|
|
width: '100%',
|
2022-09-13 07:36:00 +00:00
|
|
|
boxSizing: 'border-box' as const,
|
2021-12-15 13:18:41 +00:00
|
|
|
display: 'flex',
|
|
|
|
left: 0,
|
|
|
|
|
|
|
|
'&.tile-view-mode': {
|
2022-09-13 07:36:00 +00:00
|
|
|
padding: theme.spacing(2)
|
2021-12-15 13:18:41 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
indicatorsTopContainer: {
|
|
|
|
top: 0,
|
|
|
|
justifyContent: 'space-between'
|
|
|
|
},
|
|
|
|
|
|
|
|
indicatorsBottomContainer: {
|
|
|
|
bottom: 0
|
|
|
|
},
|
|
|
|
|
|
|
|
indicatorsBackground: {
|
|
|
|
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
|
|
borderRadius: '4px',
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
maxWidth: '100%',
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
|
|
|
'&:not(:empty)': {
|
2022-11-08 10:24:32 +00:00
|
|
|
padding: '4px 8px'
|
2021-12-15 13:18:41 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
'& > *:not(:last-child)': {
|
2022-11-08 10:24:32 +00:00
|
|
|
marginRight: '8px'
|
2021-12-15 13:18:41 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
containerBackground: {
|
2022-09-13 07:36:00 +00:00
|
|
|
position: 'absolute' as const,
|
2021-12-15 13:18:41 +00:00
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
height: '100%',
|
|
|
|
width: '100%',
|
|
|
|
borderRadius: '4px',
|
|
|
|
backgroundColor: theme.palette.ui02
|
|
|
|
},
|
|
|
|
|
2021-12-20 08:44:22 +00:00
|
|
|
borderIndicator: {
|
2022-09-13 07:36:00 +00:00
|
|
|
position: 'absolute' as const,
|
2021-12-20 08:44:22 +00:00
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
2022-03-11 13:00:49 +00:00
|
|
|
zIndex: 9,
|
2022-11-10 07:20:42 +00:00
|
|
|
borderRadius: '4px',
|
|
|
|
pointerEvents: 'none' as const
|
2021-12-20 08:44:22 +00:00
|
|
|
},
|
|
|
|
|
2022-03-11 13:00:49 +00:00
|
|
|
borderIndicatorOnTop: {
|
|
|
|
zIndex: 11
|
|
|
|
},
|
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
activeSpeaker: {
|
|
|
|
'& .active-speaker-indicator': {
|
2023-02-07 08:10:28 +00:00
|
|
|
boxShadow: `inset 0px 0px 0px 3px ${theme.palette.action01Hover} !important`
|
2021-12-20 08:44:22 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
raisedHand: {
|
|
|
|
'& .raised-hand-border': {
|
|
|
|
boxShadow: `inset 0px 0px 0px 2px ${theme.palette.warning02} !important`
|
2021-12-15 13:18:41 +00:00
|
|
|
}
|
2022-03-11 13:00:49 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
gif: {
|
2022-09-13 07:36:00 +00:00
|
|
|
position: 'absolute' as const,
|
2022-03-11 13:00:49 +00:00
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
overflow: 'hidden',
|
|
|
|
backgroundColor: theme.palette.ui02,
|
|
|
|
|
|
|
|
'& img': {
|
|
|
|
maxWidth: '100%',
|
|
|
|
maxHeight: '100%',
|
|
|
|
objectFit: 'contain',
|
|
|
|
flexGrow: '1'
|
|
|
|
}
|
2022-11-21 09:03:03 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
tintBackground: {
|
|
|
|
position: 'absolute' as const,
|
|
|
|
zIndex: 1,
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
backgroundColor: `${theme.palette.uiBackground}`,
|
|
|
|
opacity: 0.8
|
2023-02-28 10:21:15 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
keyboardPinButton: {
|
|
|
|
position: 'absolute' as const,
|
|
|
|
zIndex: 10,
|
|
|
|
|
|
|
|
/* this button is only for keyboard/screen reader users,
|
|
|
|
an onClick handler is already set elsewhere for mouse users, so make sure
|
|
|
|
we can't click on it */
|
|
|
|
pointerEvents: 'none' as const,
|
|
|
|
|
|
|
|
// make room for the border to correctly show up
|
|
|
|
left: '3px',
|
|
|
|
right: '3px',
|
|
|
|
bottom: '3px',
|
|
|
|
top: '3px'
|
2021-12-15 13:18:41 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a thumbnail.
|
|
|
|
*
|
2021-11-04 21:10:43 +00:00
|
|
|
* @augments Component
|
2020-11-09 20:59:13 +00:00
|
|
|
*/
|
2022-11-03 08:35:51 +00:00
|
|
|
class Thumbnail extends Component<IProps, IState> {
|
2021-06-30 16:12:12 +00:00
|
|
|
/**
|
|
|
|
* The long touch setTimeout handler.
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
timeoutHandle?: number;
|
2021-06-30 16:12:12 +00:00
|
|
|
|
2023-02-28 10:21:15 +00:00
|
|
|
/**
|
|
|
|
* Ref to the container of the thumbnail.
|
|
|
|
*/
|
|
|
|
containerRef?: RefObject<HTMLSpanElement>;
|
|
|
|
|
2021-10-25 09:16:03 +00:00
|
|
|
/**
|
|
|
|
* Timeout used to detect double tapping.
|
|
|
|
* It is active while user has tapped once.
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
_firstTap?: number;
|
2021-10-25 09:16:03 +00:00
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new Thumbnail instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only React Component props with which
|
|
|
|
* the new instance is to be initialized.
|
|
|
|
*/
|
2022-11-03 08:35:51 +00:00
|
|
|
constructor(props: IProps) {
|
2020-11-09 20:59:13 +00:00
|
|
|
super(props);
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
const state = {
|
|
|
|
canPlayEventReceived: false,
|
2021-11-01 09:39:19 +00:00
|
|
|
displayMode: DISPLAY_VIDEO,
|
2021-12-15 13:18:41 +00:00
|
|
|
popoverVisible: false,
|
|
|
|
isHovered: false
|
2021-01-21 20:46:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
...state,
|
2021-12-15 13:18:41 +00:00
|
|
|
displayMode: computeDisplayModeFromInput(getDisplayModeInput(props, state))
|
2020-11-09 20:59:13 +00:00
|
|
|
};
|
2022-08-25 11:35:19 +00:00
|
|
|
this.timeoutHandle = undefined;
|
2023-02-28 10:21:15 +00:00
|
|
|
this.containerRef = createRef<HTMLSpanElement>();
|
2021-10-25 09:16:03 +00:00
|
|
|
this._clearDoubleClickTimeout = this._clearDoubleClickTimeout.bind(this);
|
2021-01-21 20:46:47 +00:00
|
|
|
this._onCanPlay = this._onCanPlay.bind(this);
|
|
|
|
this._onClick = this._onClick.bind(this);
|
2023-02-28 10:21:15 +00:00
|
|
|
this._onTogglePinButtonKeyDown = this._onTogglePinButtonKeyDown.bind(this);
|
|
|
|
this._onFocus = this._onFocus.bind(this);
|
|
|
|
this._onBlur = this._onBlur.bind(this);
|
2021-01-21 20:46:47 +00:00
|
|
|
this._onMouseEnter = this._onMouseEnter.bind(this);
|
2022-02-02 20:33:30 +00:00
|
|
|
this._onMouseMove = debounce(this._onMouseMove.bind(this), 100, {
|
|
|
|
leading: true,
|
|
|
|
trailing: false
|
|
|
|
});
|
2021-01-21 20:46:47 +00:00
|
|
|
this._onMouseLeave = this._onMouseLeave.bind(this);
|
|
|
|
this._onTestingEvent = this._onTestingEvent.bind(this);
|
2021-06-30 16:12:12 +00:00
|
|
|
this._onTouchStart = this._onTouchStart.bind(this);
|
|
|
|
this._onTouchEnd = this._onTouchEnd.bind(this);
|
|
|
|
this._onTouchMove = this._onTouchMove.bind(this);
|
2021-11-01 09:39:19 +00:00
|
|
|
this._showPopover = this._showPopover.bind(this);
|
|
|
|
this._hidePopover = this._hidePopover.bind(this);
|
2022-03-11 13:00:49 +00:00
|
|
|
this._onGifMouseEnter = this._onGifMouseEnter.bind(this);
|
|
|
|
this._onGifMouseLeave = this._onGifMouseLeave.bind(this);
|
2022-04-26 20:33:50 +00:00
|
|
|
this.handleTrackStreamingStatusChanged = this.handleTrackStreamingStatusChanged.bind(this);
|
2020-11-09 20:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-25 01:37:08 +00:00
|
|
|
* Starts listening for track streaming status updates after the initial render.
|
2020-11-09 20:59:13 +00:00
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentDidMount() {
|
2021-01-21 20:46:47 +00:00
|
|
|
this._onDisplayModeChanged();
|
2022-04-26 20:33:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
// 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.
|
2022-11-08 19:15:49 +00:00
|
|
|
const { _videoTrack, dispatch } = this.props;
|
2022-04-26 20:33:50 +00:00
|
|
|
|
2022-11-08 19:15:49 +00:00
|
|
|
if (_videoTrack && !_videoTrack.local) {
|
2022-04-26 20:33:50 +00:00
|
|
|
_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.
|
2022-11-08 19:15:49 +00:00
|
|
|
const { _videoTrack, dispatch } = this.props;
|
2022-04-26 20:33:50 +00:00
|
|
|
|
2022-11-08 19:15:49 +00:00
|
|
|
if (_videoTrack && !_videoTrack.local) {
|
2022-04-26 20:33:50 +00:00
|
|
|
_videoTrack.jitsiTrack.off(JitsiTrackEvents.TRACK_STREAMING_STATUS_CHANGED,
|
|
|
|
this.handleTrackStreamingStatusChanged);
|
|
|
|
dispatch(trackStreamingStatusChanged(_videoTrack.jitsiTrack,
|
|
|
|
_videoTrack.jitsiTrack.getTrackStreamingStatus()));
|
|
|
|
}
|
2020-11-09 20:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-25 01:37:08 +00:00
|
|
|
* Stops listening for track streaming status updates on the old track and starts
|
2020-11-09 20:59:13 +00:00
|
|
|
* listening instead on the new track.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-11-03 08:35:51 +00:00
|
|
|
componentDidUpdate(prevProps: IProps, prevState: IState) {
|
2021-01-21 20:46:47 +00:00
|
|
|
if (prevState.displayMode !== this.state.displayMode) {
|
|
|
|
this._onDisplayModeChanged();
|
|
|
|
}
|
2022-04-26 20:33:50 +00:00
|
|
|
|
|
|
|
// TODO: after converting this component to a react function component,
|
|
|
|
// use a custom hook to update local track streaming status.
|
2022-11-08 19:15:49 +00:00
|
|
|
const { _videoTrack, dispatch } = this.props;
|
2022-04-26 20:33:50 +00:00
|
|
|
|
2022-11-08 19:15:49 +00:00
|
|
|
if (prevProps._videoTrack?.jitsiTrack?.getSourceName() !== _videoTrack?.jitsiTrack?.getSourceName()) {
|
2022-04-26 20:33:50 +00:00
|
|
|
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()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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}
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
handleTrackStreamingStatusChanged(jitsiTrack: any, streamingStatus: any) {
|
2022-04-26 20:33:50 +00:00
|
|
|
this.props.dispatch(trackStreamingStatusChanged(jitsiTrack, streamingStatus));
|
2021-01-21 20:46:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles display mode changes.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onDisplayModeChanged() {
|
2021-12-15 13:18:41 +00:00
|
|
|
const input = getDisplayModeInput(this.props, this.state);
|
2021-01-21 20:46:47 +00:00
|
|
|
|
|
|
|
this._maybeSendScreenSharingIssueEvents(input);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends screen sharing issue event if an issue is detected.
|
|
|
|
*
|
|
|
|
* @param {Object} input - The input used to compute the thumbnail display mode.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
_maybeSendScreenSharingIssueEvents(input: any) {
|
2021-01-21 20:46:47 +00:00
|
|
|
const {
|
|
|
|
_isAudioOnly,
|
2022-04-12 13:19:10 +00:00
|
|
|
_isScreenSharing,
|
|
|
|
_thumbnailType
|
2021-01-21 20:46:47 +00:00
|
|
|
} = this.props;
|
|
|
|
const { displayMode } = this.state;
|
2022-04-12 13:19:10 +00:00
|
|
|
const isTileType = _thumbnailType === THUMBNAIL_TYPE.TILE;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
if (!(DISPLAY_VIDEO === displayMode)
|
2022-04-12 13:19:10 +00:00
|
|
|
&& isTileType
|
2021-01-21 20:46:47 +00:00
|
|
|
&& _isScreenSharing
|
|
|
|
&& !_isAudioOnly) {
|
|
|
|
sendAnalytics(createScreenSharingIssueEvent({
|
|
|
|
source: 'thumbnail',
|
|
|
|
...input
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#getDerivedStateFromProps()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
2022-11-03 08:35:51 +00:00
|
|
|
static getDerivedStateFromProps(props: IProps, prevState: IState) {
|
2021-01-21 20:46:47 +00:00
|
|
|
if (!props._videoTrack && prevState.canPlayEventReceived) {
|
|
|
|
const newState = {
|
|
|
|
...prevState,
|
|
|
|
canPlayEventReceived: false
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
...newState,
|
2021-12-15 13:18:41 +00:00
|
|
|
displayMode: computeDisplayModeFromInput(getDisplayModeInput(props, newState))
|
2021-01-21 20:46:47 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
const newDisplayMode = computeDisplayModeFromInput(getDisplayModeInput(props, prevState));
|
2021-01-21 20:46:47 +00:00
|
|
|
|
|
|
|
if (newDisplayMode !== prevState.displayMode) {
|
|
|
|
return {
|
|
|
|
...prevState,
|
|
|
|
displayMode: newDisplayMode
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-10-25 09:16:03 +00:00
|
|
|
/**
|
|
|
|
* Clears the first click timeout.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_clearDoubleClickTimeout() {
|
|
|
|
clearTimeout(this._firstTap);
|
|
|
|
this._firstTap = undefined;
|
|
|
|
}
|
|
|
|
|
2021-11-01 09:39:19 +00:00
|
|
|
/**
|
|
|
|
* Shows popover.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_showPopover() {
|
|
|
|
this.setState({
|
|
|
|
popoverVisible: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides popover.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_hidePopover() {
|
2022-04-12 13:19:10 +00:00
|
|
|
const { _thumbnailType } = this.props;
|
2022-03-29 08:45:09 +00:00
|
|
|
|
2022-04-12 13:19:10 +00:00
|
|
|
if (_thumbnailType === THUMBNAIL_TYPE.VERTICAL) {
|
2022-03-29 08:45:09 +00:00
|
|
|
this.setState({
|
|
|
|
isHovered: false
|
|
|
|
});
|
|
|
|
}
|
2021-11-01 09:39:19 +00:00
|
|
|
this.setState({
|
|
|
|
popoverVisible: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* Returns an object with the styles for thumbnail.
|
|
|
|
*
|
|
|
|
* @returns {Object} - The styles for the thumbnail.
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
_getStyles(): any {
|
2021-10-26 08:46:01 +00:00
|
|
|
const { canPlayEventReceived } = this.state;
|
|
|
|
const {
|
2021-12-01 10:40:40 +00:00
|
|
|
_disableTileEnlargement,
|
2021-10-26 08:46:01 +00:00
|
|
|
_height,
|
2022-04-29 14:32:16 +00:00
|
|
|
_isVirtualScreenshareParticipant,
|
2021-10-26 08:46:01 +00:00
|
|
|
_isHidden,
|
|
|
|
_isScreenSharing,
|
|
|
|
_participant,
|
2022-04-12 13:19:10 +00:00
|
|
|
_thumbnailType,
|
2022-03-02 12:39:50 +00:00
|
|
|
_videoObjectPosition,
|
2021-12-20 09:32:31 +00:00
|
|
|
_videoTrack,
|
2021-10-26 08:46:01 +00:00
|
|
|
_width,
|
|
|
|
horizontalOffset,
|
|
|
|
style
|
|
|
|
} = this.props;
|
|
|
|
|
2022-04-12 13:19:10 +00:00
|
|
|
const isTileType = _thumbnailType === THUMBNAIL_TYPE.TILE;
|
2021-12-20 09:32:31 +00:00
|
|
|
const jitsiVideoTrack = _videoTrack?.jitsiTrack;
|
|
|
|
const track = jitsiVideoTrack?.track;
|
2022-09-08 09:52:36 +00:00
|
|
|
const isPortraitVideo = (track?.getSettings()?.aspectRatio || 1) < 1;
|
2021-11-24 03:26:22 +00:00
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
let styles: {
|
2022-09-08 09:52:36 +00:00
|
|
|
avatar: Object;
|
|
|
|
thumbnail: any;
|
|
|
|
video: Object;
|
2021-01-21 20:46:47 +00:00
|
|
|
} = {
|
|
|
|
thumbnail: {},
|
2021-10-26 08:46:01 +00:00
|
|
|
avatar: {},
|
|
|
|
video: {}
|
2021-01-21 20:46:47 +00:00
|
|
|
};
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2023-01-25 13:54:58 +00:00
|
|
|
const avatarSize = Math.min(_height / 2, _width - 30, 200);
|
2021-03-26 20:23:05 +00:00
|
|
|
let { left } = style || {};
|
|
|
|
|
|
|
|
if (typeof left === 'number' && horizontalOffset) {
|
|
|
|
left += horizontalOffset;
|
2020-11-09 20:59:13 +00:00
|
|
|
}
|
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
let videoStyles: any = null;
|
2022-04-12 13:19:10 +00:00
|
|
|
const doNotStretchVideo = (isPortraitVideo && isTileType)
|
2021-12-16 13:33:30 +00:00
|
|
|
|| _disableTileEnlargement
|
|
|
|
|| _isScreenSharing;
|
2021-10-26 08:46:01 +00:00
|
|
|
|
2022-04-29 14:32:16 +00:00
|
|
|
if (canPlayEventReceived || _participant.local || _isVirtualScreenshareParticipant) {
|
2021-12-16 13:33:30 +00:00
|
|
|
videoStyles = {
|
|
|
|
objectFit: doNotStretchVideo ? 'contain' : 'cover'
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
videoStyles = {
|
|
|
|
display: 'none'
|
|
|
|
};
|
2021-10-26 08:46:01 +00:00
|
|
|
}
|
|
|
|
|
2022-03-02 12:39:50 +00:00
|
|
|
if (videoStyles.objectFit === 'cover') {
|
|
|
|
videoStyles.objectPosition = _videoObjectPosition;
|
|
|
|
}
|
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
styles = {
|
|
|
|
thumbnail: {
|
|
|
|
...style,
|
|
|
|
left,
|
|
|
|
height: `${_height}px`,
|
|
|
|
minHeight: `${_height}px`,
|
|
|
|
minWidth: `${_width}px`,
|
|
|
|
width: `${_width}px`
|
|
|
|
},
|
|
|
|
avatar: {
|
|
|
|
height: `${avatarSize}px`,
|
|
|
|
width: `${avatarSize}px`
|
2021-10-26 08:46:01 +00:00
|
|
|
},
|
|
|
|
video: videoStyles
|
2021-03-26 20:23:05 +00:00
|
|
|
};
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
if (_isHidden) {
|
|
|
|
styles.thumbnail.display = 'none';
|
|
|
|
}
|
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
return styles;
|
|
|
|
}
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* On click handler.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onClick() {
|
2022-04-12 13:19:10 +00:00
|
|
|
const { _participant, dispatch, _stageFilmstripLayout } = this.props;
|
2021-01-21 20:46:47 +00:00
|
|
|
const { id, pinned } = _participant;
|
|
|
|
|
2022-04-12 13:19:10 +00:00
|
|
|
if (_stageFilmstripLayout) {
|
2022-04-12 06:57:01 +00:00
|
|
|
dispatch(togglePinStageParticipant(id));
|
2022-04-12 13:19:10 +00:00
|
|
|
} else {
|
|
|
|
dispatch(pinParticipant(pinned ? null : id));
|
2022-03-29 08:45:09 +00:00
|
|
|
}
|
2021-01-21 20:46:47 +00:00
|
|
|
}
|
|
|
|
|
2023-02-28 10:21:15 +00:00
|
|
|
/**
|
|
|
|
* This is called as a onKeydown handler on the keyboard-only button to toggle pin.
|
|
|
|
*
|
|
|
|
* @param {KeyboardEvent} event - The keydown event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onTogglePinButtonKeyDown(event: KeyboardEvent) {
|
|
|
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
|
|
this._onClick();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Keyboard focus handler.
|
|
|
|
*
|
|
|
|
* When navigating with keyboard, make things behave as we
|
|
|
|
* hover with the mouse, to make the UI show up.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onFocus() {
|
|
|
|
this.setState({ isHovered: true });
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Keyboard blur handler.
|
|
|
|
*
|
|
|
|
* When navigating with keyboard, make things behave as we
|
|
|
|
* hover with the mouse, to make the UI show up.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onBlur() {
|
|
|
|
// we need this timeout trick so that we get the actual document.activeElement value
|
|
|
|
// instead of document.body
|
|
|
|
setTimeout(() => {
|
|
|
|
// we also explicitly check for popovers, because the thumbnail can show popovers,
|
|
|
|
// and they are not rendered in the thumbnail DOM element
|
|
|
|
if (
|
|
|
|
!this.containerRef?.current?.contains(document.activeElement)
|
|
|
|
&& document.activeElement?.closest('.popover') === null
|
|
|
|
) {
|
|
|
|
this.setState({ isHovered: false });
|
|
|
|
}
|
|
|
|
}, 0);
|
|
|
|
}
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Mouse enter handler.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onMouseEnter() {
|
|
|
|
this.setState({ isHovered: true });
|
|
|
|
}
|
|
|
|
|
2022-02-02 20:33:30 +00:00
|
|
|
/**
|
|
|
|
* Mouse move handler.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onMouseMove() {
|
|
|
|
if (!this.state.isHovered) {
|
|
|
|
// Workaround for the use case where the layout changes (for example the participant pane is closed)
|
|
|
|
// and as a result the mouse appears on top of the thumbnail. In these use cases the mouse enter
|
|
|
|
// event on the thumbnail is not triggered in Chrome.
|
|
|
|
this.setState({ isHovered: true });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Mouse leave handler.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onMouseLeave() {
|
|
|
|
this.setState({ isHovered: false });
|
|
|
|
}
|
|
|
|
|
2021-06-30 16:12:12 +00:00
|
|
|
/**
|
2021-10-25 09:16:03 +00:00
|
|
|
* Handler for touch start.
|
2021-06-30 16:12:12 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onTouchStart() {
|
2022-08-25 11:35:19 +00:00
|
|
|
this.timeoutHandle = window.setTimeout(this._showPopover, SHOW_TOOLBAR_CONTEXT_MENU_AFTER);
|
2021-10-25 09:16:03 +00:00
|
|
|
|
|
|
|
if (this._firstTap) {
|
|
|
|
this._clearDoubleClickTimeout();
|
|
|
|
this._onClick();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
this._firstTap = window.setTimeout(this._clearDoubleClickTimeout, 300);
|
2021-06-30 16:12:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-08-30 14:21:58 +00:00
|
|
|
* Cancel showing popover context menu after x milliseconds if the no. Of milliseconds is not reached yet,
|
2021-06-30 16:12:12 +00:00
|
|
|
* or just clears the timeout.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onTouchEnd() {
|
|
|
|
clearTimeout(this.timeoutHandle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-08-30 14:21:58 +00:00
|
|
|
* Cancel showing Context menu after x milliseconds if the number of milliseconds is not reached
|
2021-06-30 16:12:12 +00:00
|
|
|
* before a touch move(drag), or just clears the timeout.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onTouchMove() {
|
|
|
|
clearTimeout(this.timeoutHandle);
|
|
|
|
}
|
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* Renders a fake participant (youtube video) thumbnail.
|
|
|
|
*
|
|
|
|
* @param {string} id - The id of the participant.
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
_renderFakeParticipant() {
|
2023-02-28 10:21:15 +00:00
|
|
|
const { _isMobile, _participant: { avatarURL, pinned, name } } = this.props;
|
2021-01-21 20:46:47 +00:00
|
|
|
const styles = this._getStyles();
|
|
|
|
const containerClassName = this._getContainerClassName();
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
return (
|
2021-01-21 20:46:47 +00:00
|
|
|
<span
|
2023-02-28 10:21:15 +00:00
|
|
|
aria-label = { this.props.t(pinned ? 'unpinParticipant' : 'pinParticipant', {
|
|
|
|
participantName: name
|
|
|
|
}) }
|
2021-01-21 20:46:47 +00:00
|
|
|
className = { containerClassName }
|
|
|
|
id = 'sharedVideoContainer'
|
|
|
|
onClick = { this._onClick }
|
2023-02-28 10:21:15 +00:00
|
|
|
onKeyDown = { this._onTogglePinButtonKeyDown }
|
2021-07-20 08:30:12 +00:00
|
|
|
{ ...(_isMobile ? {} : {
|
|
|
|
onMouseEnter: this._onMouseEnter,
|
2022-02-02 20:33:30 +00:00
|
|
|
onMouseMove: this._onMouseMove,
|
2021-07-20 08:30:12 +00:00
|
|
|
onMouseLeave: this._onMouseLeave
|
|
|
|
}) }
|
2023-02-28 10:21:15 +00:00
|
|
|
role = 'button'
|
|
|
|
style = { styles.thumbnail }
|
|
|
|
tabIndex = { 0 }>
|
2021-04-16 09:43:34 +00:00
|
|
|
{avatarURL ? (
|
|
|
|
<img
|
|
|
|
className = 'sharedVideoAvatar'
|
|
|
|
src = { avatarURL } />
|
|
|
|
)
|
|
|
|
: this._renderAvatar(styles.avatar)}
|
2021-01-21 20:46:47 +00:00
|
|
|
</span>
|
2020-11-09 20:59:13 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the avatar.
|
|
|
|
*
|
2021-01-21 20:46:47 +00:00
|
|
|
* @param {Object} styles - The styles that will be applied to the avatar.
|
2020-11-09 20:59:13 +00:00
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
_renderAvatar(styles: Object) {
|
2020-11-09 20:59:13 +00:00
|
|
|
const { _participant } = this.props;
|
|
|
|
const { id } = _participant;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className = 'avatar-container'
|
2021-01-21 20:46:47 +00:00
|
|
|
style = { styles }>
|
2020-11-09 20:59:13 +00:00
|
|
|
<Avatar
|
|
|
|
className = 'userAvatar'
|
|
|
|
participantId = { id } />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Returns the container class name.
|
|
|
|
*
|
|
|
|
* @returns {string} - The class name that will be used for the container.
|
|
|
|
*/
|
|
|
|
_getContainerClassName() {
|
|
|
|
let className = 'videocontainer';
|
|
|
|
const { displayMode } = this.state;
|
2020-11-09 20:59:13 +00:00
|
|
|
const {
|
2021-12-15 13:18:41 +00:00
|
|
|
_isDominantSpeakerDisabled,
|
2020-11-09 20:59:13 +00:00
|
|
|
_participant,
|
2021-12-20 08:44:22 +00:00
|
|
|
_raisedHand,
|
2022-04-12 13:19:10 +00:00
|
|
|
_thumbnailType,
|
2021-12-15 13:18:41 +00:00
|
|
|
classes
|
2020-11-09 20:59:13 +00:00
|
|
|
} = this.props;
|
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
className += ` ${DISPLAY_MODE_TO_CLASS_NAME[displayMode]}`;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2021-12-20 08:44:22 +00:00
|
|
|
if (_raisedHand) {
|
|
|
|
className += ` ${classes.raisedHand}`;
|
|
|
|
}
|
|
|
|
|
2022-03-29 08:45:09 +00:00
|
|
|
if (!_isDominantSpeakerDisabled && _participant?.dominantSpeaker) {
|
2021-12-15 13:18:41 +00:00
|
|
|
className += ` ${classes.activeSpeaker} dominant-speaker`;
|
|
|
|
}
|
2022-04-12 13:19:10 +00:00
|
|
|
if (_thumbnailType !== THUMBNAIL_TYPE.TILE && _participant?.pinned) {
|
2022-03-29 08:45:09 +00:00
|
|
|
className += ' videoContainerFocused';
|
|
|
|
}
|
2021-06-30 16:12:12 +00:00
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
return className;
|
2020-11-09 20:59:13 +00:00
|
|
|
}
|
|
|
|
|
2022-03-11 13:00:49 +00:00
|
|
|
/**
|
|
|
|
* Keep showing the GIF for the current participant.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onGifMouseEnter() {
|
|
|
|
const { dispatch, _participant: { id } } = this.props;
|
|
|
|
|
|
|
|
dispatch(showGif(id));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Keep showing the GIF for the current participant.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onGifMouseLeave() {
|
|
|
|
const { dispatch, _participant: { id } } = this.props;
|
|
|
|
|
|
|
|
dispatch(hideGif(id));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders GIF.
|
|
|
|
*
|
|
|
|
* @returns {Component}
|
|
|
|
*/
|
|
|
|
_renderGif() {
|
|
|
|
const { _gifSrc, classes } = this.props;
|
|
|
|
|
|
|
|
return _gifSrc && (
|
2022-03-30 13:08:19 +00:00
|
|
|
<div className = { classes.gif }>
|
2022-03-11 13:00:49 +00:00
|
|
|
<img
|
|
|
|
alt = 'GIF'
|
|
|
|
src = { _gifSrc } />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Canplay event listener.
|
|
|
|
*
|
|
|
|
* @param {SyntheticEvent} event - The event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
_onCanPlay(event: any) {
|
2021-01-21 20:46:47 +00:00
|
|
|
this.setState({ canPlayEventReceived: true });
|
|
|
|
|
|
|
|
const {
|
|
|
|
_isTestModeEnabled,
|
|
|
|
_videoTrack
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (_videoTrack && _isTestModeEnabled) {
|
|
|
|
this._onTestingEvent(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Event handler for testing events.
|
|
|
|
*
|
|
|
|
* @param {SyntheticEvent} event - The event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
_onTestingEvent(event: any) {
|
2021-01-21 20:46:47 +00:00
|
|
|
const {
|
|
|
|
_videoTrack,
|
|
|
|
dispatch
|
|
|
|
} = this.props;
|
|
|
|
const jitsiVideoTrack = _videoTrack?.jitsiTrack;
|
|
|
|
|
|
|
|
dispatch(updateLastTrackVideoMediaEvent(jitsiVideoTrack, event.type));
|
|
|
|
}
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders a remote participant's 'thumbnail.
|
|
|
|
*
|
2021-12-15 13:18:41 +00:00
|
|
|
* @param {boolean} local - Whether or not it's the local participant.
|
2020-11-09 20:59:13 +00:00
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
2021-12-15 13:18:41 +00:00
|
|
|
_renderParticipant(local = false) {
|
2020-11-09 20:59:13 +00:00
|
|
|
const {
|
2021-12-15 13:18:41 +00:00
|
|
|
_audioTrack,
|
|
|
|
_disableLocalVideoFlip,
|
2022-04-12 13:19:10 +00:00
|
|
|
_gifSrc,
|
2021-07-20 08:30:12 +00:00
|
|
|
_isMobile,
|
2021-12-15 13:18:41 +00:00
|
|
|
_isMobilePortrait,
|
|
|
|
_isScreenSharing,
|
2021-01-21 20:46:47 +00:00
|
|
|
_isTestModeEnabled,
|
2021-12-15 13:18:41 +00:00
|
|
|
_localFlipX,
|
2020-11-09 20:59:13 +00:00
|
|
|
_participant,
|
2022-11-21 09:03:03 +00:00
|
|
|
_shouldDisplayTintBackground,
|
2022-04-12 13:19:10 +00:00
|
|
|
_thumbnailType,
|
2021-03-26 20:23:05 +00:00
|
|
|
_videoTrack,
|
2022-03-11 13:00:49 +00:00
|
|
|
classes,
|
2023-02-28 10:21:15 +00:00
|
|
|
filmstripType,
|
|
|
|
t
|
2020-11-09 20:59:13 +00:00
|
|
|
} = this.props;
|
2023-02-28 10:21:15 +00:00
|
|
|
const { id, name, pinned } = _participant || {};
|
2021-12-15 13:18:41 +00:00
|
|
|
const { isHovered, popoverVisible } = this.state;
|
2021-01-21 20:46:47 +00:00
|
|
|
const styles = this._getStyles();
|
2021-12-15 13:18:41 +00:00
|
|
|
let containerClassName = this._getContainerClassName();
|
|
|
|
const videoTrackClassName
|
|
|
|
= !_disableLocalVideoFlip && _videoTrack && !_isScreenSharing && _localFlipX ? 'flipVideoX' : '';
|
2021-01-21 20:46:47 +00:00
|
|
|
const jitsiVideoTrack = _videoTrack?.jitsiTrack;
|
2022-09-08 09:52:36 +00:00
|
|
|
const videoTrackId = jitsiVideoTrack?.getId();
|
2022-08-25 11:35:19 +00:00
|
|
|
const videoEventListeners: any = {};
|
2023-02-28 10:21:15 +00:00
|
|
|
const pinButtonLabel = t(pinned ? 'unpinParticipant' : 'pinParticipant', {
|
|
|
|
participantName: name
|
|
|
|
});
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
if (local) {
|
|
|
|
if (_isMobilePortrait) {
|
|
|
|
styles.thumbnail.height = styles.thumbnail.width;
|
|
|
|
containerClassName = `${containerClassName} self-view-mobile-portrait`;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (_videoTrack && _isTestModeEnabled) {
|
|
|
|
VIDEO_TEST_EVENTS.forEach(attribute => {
|
|
|
|
videoEventListeners[attribute] = this._onTestingEvent;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
videoEventListeners.onCanPlay = this._onCanPlay;
|
2021-01-21 20:46:47 +00:00
|
|
|
}
|
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
const video = _videoTrack && <VideoTrack
|
|
|
|
className = { local ? videoTrackClassName : '' }
|
|
|
|
eventHandlers = { videoEventListeners }
|
|
|
|
id = { local ? 'localVideo_container' : `remoteVideo_${videoTrackId || ''}` }
|
|
|
|
muted = { local ? undefined : true }
|
|
|
|
style = { styles.video }
|
|
|
|
videoTrack = { _videoTrack } />;
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
return (
|
2021-01-21 20:46:47 +00:00
|
|
|
<span
|
|
|
|
className = { containerClassName }
|
2022-03-29 08:45:09 +00:00
|
|
|
id = { local
|
2022-06-29 13:59:49 +00:00
|
|
|
? `localVideoContainer${filmstripType === FILMSTRIP_TYPE.MAIN ? '' : `_${filmstripType}`}`
|
|
|
|
: `participant_${id}${filmstripType === FILMSTRIP_TYPE.MAIN ? '' : `_${filmstripType}`}`
|
2022-03-29 08:45:09 +00:00
|
|
|
}
|
2023-02-28 10:21:15 +00:00
|
|
|
onBlur = { this._onBlur }
|
|
|
|
onFocus = { this._onFocus }
|
2021-07-20 08:30:12 +00:00
|
|
|
{ ...(_isMobile
|
|
|
|
? {
|
|
|
|
onTouchEnd: this._onTouchEnd,
|
|
|
|
onTouchMove: this._onTouchMove,
|
|
|
|
onTouchStart: this._onTouchStart
|
|
|
|
}
|
|
|
|
: {
|
2021-10-25 11:19:13 +00:00
|
|
|
onClick: this._onClick,
|
2021-07-20 08:30:12 +00:00
|
|
|
onMouseEnter: this._onMouseEnter,
|
2022-02-02 20:33:30 +00:00
|
|
|
onMouseMove: this._onMouseMove,
|
2021-07-20 08:30:12 +00:00
|
|
|
onMouseLeave: this._onMouseLeave
|
|
|
|
}
|
|
|
|
) }
|
2023-02-28 10:21:15 +00:00
|
|
|
ref = { this.containerRef }
|
2021-01-21 20:46:47 +00:00
|
|
|
style = { styles.thumbnail }>
|
2023-02-28 10:21:15 +00:00
|
|
|
{/* this "button" is invisible, only here so that
|
|
|
|
keyboard/screen reader users can pin/unpin */}
|
|
|
|
<Tooltip
|
|
|
|
content = { pinButtonLabel }>
|
|
|
|
<span
|
|
|
|
aria-label = { pinButtonLabel }
|
|
|
|
className = { classes.keyboardPinButton }
|
|
|
|
onKeyDown = { this._onTogglePinButtonKeyDown }
|
|
|
|
role = 'button'
|
|
|
|
tabIndex = { 0 } />
|
|
|
|
</Tooltip>
|
2022-03-11 13:00:49 +00:00
|
|
|
{!_gifSrc && (local
|
2021-12-15 13:18:41 +00:00
|
|
|
? <span id = 'localVideoWrapper'>{video}</span>
|
2022-03-11 13:00:49 +00:00
|
|
|
: video)}
|
2021-12-15 13:18:41 +00:00
|
|
|
<div className = { classes.containerBackground } />
|
|
|
|
<div
|
|
|
|
className = { clsx(classes.indicatorsContainer,
|
|
|
|
classes.indicatorsTopContainer,
|
2022-04-12 13:19:10 +00:00
|
|
|
_thumbnailType === THUMBNAIL_TYPE.TILE && 'tile-view-mode'
|
2021-12-15 13:18:41 +00:00
|
|
|
) }>
|
|
|
|
<ThumbnailTopIndicators
|
2022-10-06 11:12:57 +00:00
|
|
|
disableConnectionIndicator = { isWhiteboardParticipant(_participant) }
|
2021-12-15 13:18:41 +00:00
|
|
|
hidePopover = { this._hidePopover }
|
|
|
|
indicatorsClassName = { classes.indicatorsBackground }
|
|
|
|
isHovered = { isHovered }
|
|
|
|
local = { local }
|
|
|
|
participantId = { id }
|
|
|
|
popoverVisible = { popoverVisible }
|
2022-04-12 13:19:10 +00:00
|
|
|
showPopover = { this._showPopover }
|
|
|
|
thumbnailType = { _thumbnailType } />
|
2020-11-09 20:59:13 +00:00
|
|
|
</div>
|
2022-11-21 09:03:03 +00:00
|
|
|
{_shouldDisplayTintBackground && <div className = { classes.tintBackground } />}
|
2021-12-15 13:18:41 +00:00
|
|
|
<div
|
|
|
|
className = { clsx(classes.indicatorsContainer,
|
|
|
|
classes.indicatorsBottomContainer,
|
2022-04-12 13:19:10 +00:00
|
|
|
_thumbnailType === THUMBNAIL_TYPE.TILE && 'tile-view-mode'
|
2021-12-15 13:18:41 +00:00
|
|
|
) }>
|
|
|
|
<ThumbnailBottomIndicators
|
|
|
|
className = { classes.indicatorsBackground }
|
|
|
|
local = { local }
|
2022-04-12 13:19:10 +00:00
|
|
|
participantId = { id }
|
2022-10-06 11:12:57 +00:00
|
|
|
showStatusIndicators = { !isWhiteboardParticipant(_participant) }
|
2022-04-12 13:19:10 +00:00
|
|
|
thumbnailType = { _thumbnailType } />
|
2020-11-09 20:59:13 +00:00
|
|
|
</div>
|
2022-03-11 13:00:49 +00:00
|
|
|
{!_gifSrc && this._renderAvatar(styles.avatar) }
|
2021-12-15 13:18:41 +00:00
|
|
|
{ !local && (
|
|
|
|
<div className = 'presence-label-container'>
|
|
|
|
<PresenceLabel
|
|
|
|
className = 'presence-label'
|
|
|
|
participantID = { id } />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
<ThumbnailAudioIndicator _audioTrack = { _audioTrack } />
|
2022-03-11 13:00:49 +00:00
|
|
|
{this._renderGif()}
|
|
|
|
<div
|
|
|
|
className = { clsx(classes.borderIndicator,
|
|
|
|
_gifSrc && classes.borderIndicatorOnTop,
|
|
|
|
'raised-hand-border') } />
|
|
|
|
<div
|
|
|
|
className = { clsx(classes.borderIndicator,
|
|
|
|
_gifSrc && classes.borderIndicatorOnTop,
|
|
|
|
'active-speaker-indicator') } />
|
2022-03-30 13:08:19 +00:00
|
|
|
{_gifSrc && (
|
|
|
|
<div
|
|
|
|
className = { clsx(classes.borderIndicator, classes.borderIndicatorOnTop) }
|
|
|
|
onMouseEnter = { this._onGifMouseEnter }
|
|
|
|
onMouseLeave = { this._onGifMouseLeave } />
|
|
|
|
)}
|
2021-01-21 20:46:47 +00:00
|
|
|
</span>
|
2020-11-09 20:59:13 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2022-11-21 09:03:03 +00:00
|
|
|
const {
|
|
|
|
_isTestModeEnabled,
|
|
|
|
_isVirtualScreenshareParticipant,
|
|
|
|
_participant,
|
|
|
|
_shouldDisplayTintBackground
|
|
|
|
} = this.props;
|
2022-09-16 15:25:54 +00:00
|
|
|
const videoEventListeners: any = {};
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
if (!_participant) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-10-06 11:12:57 +00:00
|
|
|
const { fakeParticipant, local } = _participant;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
if (local) {
|
2021-12-15 13:18:41 +00:00
|
|
|
return this._renderParticipant(true);
|
2020-11-09 20:59:13 +00:00
|
|
|
}
|
|
|
|
|
2022-10-06 11:12:57 +00:00
|
|
|
if (fakeParticipant
|
|
|
|
&& !isWhiteboardParticipant(_participant)
|
|
|
|
&& !_isVirtualScreenshareParticipant
|
|
|
|
) {
|
2020-11-09 20:59:13 +00:00
|
|
|
return this._renderFakeParticipant();
|
|
|
|
}
|
|
|
|
|
2022-04-29 14:32:16 +00:00
|
|
|
if (_isVirtualScreenshareParticipant) {
|
2022-04-04 18:57:58 +00:00
|
|
|
const { isHovered } = this.state;
|
2022-04-28 22:25:45 +00:00
|
|
|
const { _videoTrack, _isMobile, classes, _thumbnailType } = this.props;
|
2022-04-04 18:57:58 +00:00
|
|
|
|
2022-09-16 15:25:54 +00:00
|
|
|
if (_isTestModeEnabled) {
|
|
|
|
VIDEO_TEST_EVENTS.forEach(attribute => {
|
|
|
|
videoEventListeners[attribute] = this._onTestingEvent;
|
|
|
|
});
|
|
|
|
videoEventListeners.onCanPlay = this._onCanPlay;
|
|
|
|
}
|
|
|
|
|
2022-04-04 18:57:58 +00:00
|
|
|
return (
|
2022-04-29 14:32:16 +00:00
|
|
|
<VirtualScreenshareParticipant
|
2022-04-04 18:57:58 +00:00
|
|
|
classes = { classes }
|
|
|
|
containerClassName = { this._getContainerClassName() }
|
|
|
|
isHovered = { isHovered }
|
2022-10-06 11:12:57 +00:00
|
|
|
isLocal = { isLocalScreenshareParticipant(_participant) }
|
2022-04-04 18:57:58 +00:00
|
|
|
isMobile = { _isMobile }
|
|
|
|
onClick = { this._onClick }
|
|
|
|
onMouseEnter = { this._onMouseEnter }
|
|
|
|
onMouseLeave = { this._onMouseLeave }
|
|
|
|
onMouseMove = { this._onMouseMove }
|
|
|
|
onTouchEnd = { this._onTouchEnd }
|
|
|
|
onTouchMove = { this._onTouchMove }
|
|
|
|
onTouchStart = { this._onTouchStart }
|
|
|
|
participantId = { _participant.id }
|
2022-11-21 09:03:03 +00:00
|
|
|
shouldDisplayTintBackground = { _shouldDisplayTintBackground }
|
2022-04-04 18:57:58 +00:00
|
|
|
styles = { this._getStyles() }
|
2022-04-28 22:25:45 +00:00
|
|
|
thumbnailType = { _thumbnailType }
|
2022-04-04 18:57:58 +00:00
|
|
|
videoTrack = { _videoTrack } />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
return this._renderParticipant();
|
2020-11-09 20:59:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the associated props for this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @param {Object} ownProps - The own props of the component.
|
|
|
|
* @private
|
2022-11-03 08:35:51 +00:00
|
|
|
* @returns {IProps}
|
2020-11-09 20:59:13 +00:00
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
function _mapStateToProps(state: IReduxState, ownProps: any): Object {
|
2022-06-29 13:59:49 +00:00
|
|
|
const { participantID, filmstripType = FILMSTRIP_TYPE.MAIN } = ownProps;
|
2020-11-09 20:59:13 +00:00
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
const participant = getParticipantByIdOrUndefined(state, participantID);
|
2022-10-11 10:47:54 +00:00
|
|
|
const id = participant?.id ?? '';
|
2020-11-09 20:59:13 +00:00
|
|
|
const isLocal = participant?.local ?? true;
|
2022-11-08 19:15:49 +00:00
|
|
|
const _isVirtualScreenshareParticipant = isScreenShareParticipant(participant);
|
2022-09-16 15:25:54 +00:00
|
|
|
const tracks = state['features/base/tracks'];
|
2022-11-08 19:15:49 +00:00
|
|
|
const _videoTrack = getVideoTrackByParticipant(state, participant);
|
2020-11-09 20:59:13 +00:00
|
|
|
const _audioTrack = isLocal
|
2022-11-08 19:15:49 +00:00
|
|
|
? getLocalAudioTrack(tracks)
|
|
|
|
: getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.AUDIO, id);
|
2022-11-28 10:52:45 +00:00
|
|
|
const _currentLayout = getCurrentLayout(state) ?? '';
|
2022-08-25 11:35:19 +00:00
|
|
|
let size: any = {};
|
2021-09-09 13:14:09 +00:00
|
|
|
let _isMobilePortrait = false;
|
2021-01-21 20:46:47 +00:00
|
|
|
const {
|
2021-11-26 15:39:34 +00:00
|
|
|
defaultLocalDisplayName,
|
2021-01-21 20:46:47 +00:00
|
|
|
disableLocalVideoFlip,
|
2021-12-01 10:40:40 +00:00
|
|
|
disableTileEnlargement,
|
2021-01-21 20:46:47 +00:00
|
|
|
iAmRecorder,
|
|
|
|
iAmSipGateway
|
|
|
|
} = state['features/base/config'];
|
|
|
|
const { localFlipX } = state['features/base/settings'];
|
2021-07-20 08:30:12 +00:00
|
|
|
const _isMobile = isMobileBrowser();
|
2022-03-29 08:45:09 +00:00
|
|
|
const activeParticipants = getActiveParticipantsIds(state);
|
2022-06-29 13:59:49 +00:00
|
|
|
const tileType = getThumbnailTypeFromLayout(_currentLayout, filmstripType);
|
2022-04-12 13:19:10 +00:00
|
|
|
|
|
|
|
switch (tileType) {
|
|
|
|
case THUMBNAIL_TYPE.VERTICAL:
|
|
|
|
case THUMBNAIL_TYPE.HORIZONTAL: {
|
2020-11-09 20:59:13 +00:00
|
|
|
const {
|
|
|
|
horizontalViewDimensions = {
|
|
|
|
local: {},
|
|
|
|
remote: {}
|
2021-03-26 20:23:05 +00:00
|
|
|
},
|
|
|
|
verticalViewDimensions = {
|
|
|
|
local: {},
|
2022-02-24 12:20:37 +00:00
|
|
|
remote: {},
|
|
|
|
gridView: {}
|
2020-11-09 20:59:13 +00:00
|
|
|
}
|
|
|
|
} = state['features/filmstrip'];
|
2022-02-24 12:20:37 +00:00
|
|
|
const _verticalViewGrid = showGridInVerticalView(state);
|
2021-03-26 20:23:05 +00:00
|
|
|
const { local, remote }
|
2022-04-12 13:19:10 +00:00
|
|
|
= tileType === THUMBNAIL_TYPE.VERTICAL
|
2021-03-26 20:23:05 +00:00
|
|
|
? verticalViewDimensions : horizontalViewDimensions;
|
2023-02-02 11:12:31 +00:00
|
|
|
|
2022-09-05 11:24:13 +00:00
|
|
|
// @ts-ignore
|
2022-02-24 12:20:37 +00:00
|
|
|
const { width, height } = (isLocal ? local : remote) ?? {};
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
size = {
|
|
|
|
_width: width,
|
|
|
|
_height: height
|
|
|
|
};
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
if (_verticalViewGrid) {
|
2022-09-05 11:24:13 +00:00
|
|
|
// @ts-ignore
|
2022-02-24 12:20:37 +00:00
|
|
|
const { width: _width, height: _height } = verticalViewDimensions.gridView.thumbnailSize;
|
|
|
|
|
|
|
|
size = {
|
|
|
|
_width,
|
|
|
|
_height
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-09-09 13:14:09 +00:00
|
|
|
_isMobilePortrait = _isMobile && state['features/base/responsive-ui'].aspectRatio === ASPECT_RATIO_NARROW;
|
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-04-12 13:19:10 +00:00
|
|
|
case THUMBNAIL_TYPE.TILE: {
|
2022-09-05 11:24:13 +00:00
|
|
|
// @ts-ignore
|
2022-03-29 08:45:09 +00:00
|
|
|
const { thumbnailSize } = state['features/filmstrip'].tileViewDimensions;
|
|
|
|
const {
|
|
|
|
stageFilmstripDimensions = {
|
|
|
|
thumbnailSize: {}
|
2022-06-29 13:59:49 +00:00
|
|
|
},
|
|
|
|
screenshareFilmstripDimensions
|
2022-03-29 08:45:09 +00:00
|
|
|
} = state['features/filmstrip'];
|
2020-11-09 20:59:13 +00:00
|
|
|
|
|
|
|
size = {
|
2022-03-29 08:45:09 +00:00
|
|
|
_width: thumbnailSize?.width,
|
|
|
|
_height: thumbnailSize?.height
|
2020-11-09 20:59:13 +00:00
|
|
|
};
|
2022-03-29 08:45:09 +00:00
|
|
|
|
2022-06-29 13:59:49 +00:00
|
|
|
if (filmstripType === FILMSTRIP_TYPE.STAGE) {
|
2022-09-05 11:24:13 +00:00
|
|
|
// @ts-ignore
|
2022-03-29 08:45:09 +00:00
|
|
|
const { width: _width, height: _height } = stageFilmstripDimensions.thumbnailSize;
|
|
|
|
|
|
|
|
size = {
|
|
|
|
_width,
|
2022-06-29 13:59:49 +00:00
|
|
|
_height
|
|
|
|
};
|
|
|
|
} else if (filmstripType === FILMSTRIP_TYPE.SCREENSHARE) {
|
2022-09-05 11:24:13 +00:00
|
|
|
// @ts-ignore
|
2022-06-29 13:59:49 +00:00
|
|
|
const { width: _width, height: _height } = screenshareFilmstripDimensions.thumbnailSize;
|
|
|
|
|
|
|
|
size = {
|
|
|
|
_width,
|
2022-03-29 08:45:09 +00:00
|
|
|
_height
|
|
|
|
};
|
|
|
|
}
|
2020-11-09 20:59:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-03 21:55:33 +00:00
|
|
|
if (ownProps.width) {
|
|
|
|
size._width = ownProps.width;
|
|
|
|
}
|
|
|
|
|
2022-09-29 11:45:34 +00:00
|
|
|
const { gifUrl: gifSrc } = getGifForParticipant(state, id ?? '');
|
2022-03-11 13:00:49 +00:00
|
|
|
const mode = getGifDisplayMode(state);
|
2022-09-14 07:54:56 +00:00
|
|
|
const participantId = isLocal ? getLocalParticipant(state)?.id : participantID;
|
2022-11-21 09:03:03 +00:00
|
|
|
const isActiveParticipant = activeParticipants.find((pId: string) => pId === participantId);
|
|
|
|
const participantCurrentlyOnLargeVideo = state['features/large-video']?.participantId === id;
|
|
|
|
const shouldDisplayTintBackground
|
|
|
|
= _currentLayout !== LAYOUTS.TILE_VIEW && filmstripType === FILMSTRIP_TYPE.MAIN
|
|
|
|
&& (isActiveParticipant || participantCurrentlyOnLargeVideo);
|
2022-03-11 13:00:49 +00:00
|
|
|
|
2020-11-09 20:59:13 +00:00
|
|
|
return {
|
|
|
|
_audioTrack,
|
2022-04-29 14:32:16 +00:00
|
|
|
_currentLayout,
|
2021-11-26 15:39:34 +00:00
|
|
|
_defaultLocalDisplayName: defaultLocalDisplayName,
|
2021-01-21 20:46:47 +00:00
|
|
|
_disableLocalVideoFlip: Boolean(disableLocalVideoFlip),
|
2021-12-01 10:40:40 +00:00
|
|
|
_disableTileEnlargement: Boolean(disableTileEnlargement),
|
2022-11-21 09:03:03 +00:00
|
|
|
_isActiveParticipant: isActiveParticipant,
|
2021-01-21 20:46:47 +00:00
|
|
|
_isHidden: isLocal && iAmRecorder && !iAmSipGateway,
|
|
|
|
_isAudioOnly: Boolean(state['features/base/audio-only'].enabled),
|
2022-11-21 09:03:03 +00:00
|
|
|
_isCurrentlyOnLargeVideo: participantCurrentlyOnLargeVideo,
|
2020-11-09 20:59:13 +00:00
|
|
|
_isDominantSpeakerDisabled: interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR,
|
2021-07-20 08:30:12 +00:00
|
|
|
_isMobile,
|
2021-09-09 13:14:09 +00:00
|
|
|
_isMobilePortrait,
|
2021-01-21 20:46:47 +00:00
|
|
|
_isScreenSharing: _videoTrack?.videoType === 'desktop',
|
|
|
|
_isTestModeEnabled: isTestModeEnabled(state),
|
2021-07-09 12:36:19 +00:00
|
|
|
_isVideoPlayable: id && isVideoPlayable(state, id),
|
2022-10-06 11:12:57 +00:00
|
|
|
_isVirtualScreenshareParticipant,
|
2021-01-21 20:46:47 +00:00
|
|
|
_localFlipX: Boolean(localFlipX),
|
2020-11-09 20:59:13 +00:00
|
|
|
_participant: participant,
|
2021-12-20 08:44:22 +00:00
|
|
|
_raisedHand: hasRaisedHand(participant),
|
2022-04-12 13:19:10 +00:00
|
|
|
_stageFilmstripLayout: isStageFilmstripAvailable(state),
|
|
|
|
_stageParticipantsVisible: _currentLayout === LAYOUTS.STAGE_FILMSTRIP_VIEW,
|
2022-11-21 09:03:03 +00:00
|
|
|
_shouldDisplayTintBackground: shouldDisplayTintBackground,
|
2022-04-12 13:19:10 +00:00
|
|
|
_thumbnailType: tileType,
|
2022-03-04 23:17:46 +00:00
|
|
|
_videoObjectPosition: getVideoObjectPosition(state, participant?.id),
|
2020-11-09 20:59:13 +00:00
|
|
|
_videoTrack,
|
2022-03-11 13:00:49 +00:00
|
|
|
...size,
|
2022-09-16 15:25:54 +00:00
|
|
|
_gifSrc: mode === 'chat' ? null : gifSrc
|
2020-11-09 20:59:13 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-02-28 10:21:15 +00:00
|
|
|
export default connect(_mapStateToProps)(withStyles(defaultStyles)(translate(Thumbnail)));
|