2020-02-18 16:31:04 +00:00
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
2020-10-23 22:48:56 +00:00
|
|
|
import { MEDIA_TYPE } from '../../../base/media';
|
2021-07-09 12:36:19 +00:00
|
|
|
import { getParticipantByIdOrUndefined, PARTICIPANT_ROLE } from '../../../base/participants';
|
2020-02-18 16:31:04 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2020-10-26 19:51:51 +00:00
|
|
|
import { getTrackByMediaTypeAndParticipant, isLocalTrackMuted, isRemoteTrackMuted } from '../../../base/tracks';
|
2020-02-18 16:31:04 +00:00
|
|
|
import { getCurrentLayout, LAYOUTS } from '../../../video-layout';
|
|
|
|
|
|
|
|
import AudioMutedIndicator from './AudioMutedIndicator';
|
|
|
|
import ModeratorIndicator from './ModeratorIndicator';
|
2020-07-17 09:41:49 +00:00
|
|
|
import ScreenShareIndicator from './ScreenShareIndicator';
|
2020-02-18 16:31:04 +00:00
|
|
|
import VideoMutedIndicator from './VideoMutedIndicator';
|
|
|
|
|
|
|
|
declare var interfaceConfig: Object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link StatusIndicators}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The current layout of the filmstrip.
|
|
|
|
*/
|
|
|
|
_currentLayout: string,
|
|
|
|
|
2020-10-26 17:58:37 +00:00
|
|
|
/**
|
|
|
|
* Indicates if the audio muted indicator should be visible or not.
|
|
|
|
*/
|
|
|
|
_showAudioMutedIndicator: Boolean,
|
|
|
|
|
2020-02-18 16:31:04 +00:00
|
|
|
/**
|
|
|
|
* Indicates if the moderator indicator should be visible or not.
|
|
|
|
*/
|
|
|
|
_showModeratorIndicator: Boolean,
|
|
|
|
|
2020-10-23 22:48:56 +00:00
|
|
|
/**
|
2020-10-26 19:51:51 +00:00
|
|
|
* Indicates if the screen share indicator should be visible or not.
|
2020-10-23 22:48:56 +00:00
|
|
|
*/
|
2020-10-26 19:51:51 +00:00
|
|
|
_showScreenShareIndicator: Boolean,
|
2020-10-23 22:48:56 +00:00
|
|
|
|
2020-07-17 09:41:49 +00:00
|
|
|
/**
|
2020-10-26 19:51:51 +00:00
|
|
|
* Indicates if the video muted indicator should be visible or not.
|
2020-07-17 09:41:49 +00:00
|
|
|
*/
|
2020-10-26 19:51:51 +00:00
|
|
|
_showVideoMutedIndicator: Boolean,
|
2020-07-17 09:41:49 +00:00
|
|
|
|
2020-02-18 16:31:04 +00:00
|
|
|
/**
|
|
|
|
* The ID of the participant for which the status bar is rendered.
|
|
|
|
*/
|
|
|
|
participantID: String
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* React {@code Component} for showing the status bar in a thumbnail.
|
|
|
|
*
|
|
|
|
* @extends Component
|
|
|
|
*/
|
|
|
|
class StatusIndicators extends Component<Props> {
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
_currentLayout,
|
2020-10-26 17:58:37 +00:00
|
|
|
_showAudioMutedIndicator,
|
2020-02-18 16:31:04 +00:00
|
|
|
_showModeratorIndicator,
|
2020-10-26 19:51:51 +00:00
|
|
|
_showScreenShareIndicator,
|
2020-10-23 22:48:56 +00:00
|
|
|
_showVideoMutedIndicator
|
2020-02-18 16:31:04 +00:00
|
|
|
} = this.props;
|
|
|
|
let tooltipPosition;
|
|
|
|
|
|
|
|
switch (_currentLayout) {
|
|
|
|
case LAYOUTS.TILE_VIEW:
|
|
|
|
tooltipPosition = 'right';
|
|
|
|
break;
|
|
|
|
case LAYOUTS.VERTICAL_FILMSTRIP_VIEW:
|
|
|
|
tooltipPosition = 'left';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
tooltipPosition = 'top';
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
2020-10-26 17:58:37 +00:00
|
|
|
{ _showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
|
2020-10-26 19:51:51 +00:00
|
|
|
{ _showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
|
2020-10-23 22:48:56 +00:00
|
|
|
{ _showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
|
2020-02-18 16:31:04 +00:00
|
|
|
{ _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated {@code StatusIndicators}'s props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @param {Object} ownProps - The own props of the component.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
|
|
|
* _currentLayout: string,
|
2020-10-23 22:48:56 +00:00
|
|
|
* _showModeratorIndicator: boolean,
|
|
|
|
* _showVideoMutedIndicator: boolean
|
2020-02-18 16:31:04 +00:00
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state, ownProps) {
|
|
|
|
const { participantID } = ownProps;
|
|
|
|
|
|
|
|
// Only the local participant won't have id for the time when the conference is not yet joined.
|
2021-07-09 12:36:19 +00:00
|
|
|
const participant = getParticipantByIdOrUndefined(state, participantID);
|
2020-02-18 16:31:04 +00:00
|
|
|
|
2020-10-23 22:48:56 +00:00
|
|
|
const tracks = state['features/base/tracks'];
|
|
|
|
let isVideoMuted = true;
|
2020-10-26 17:58:37 +00:00
|
|
|
let isAudioMuted = true;
|
2020-10-26 19:51:51 +00:00
|
|
|
let isScreenSharing = false;
|
2020-10-23 22:48:56 +00:00
|
|
|
|
|
|
|
if (participant?.local) {
|
|
|
|
isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
|
2020-10-26 17:58:37 +00:00
|
|
|
isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
|
2020-10-23 22:48:56 +00:00
|
|
|
} else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
|
2020-10-26 19:51:51 +00:00
|
|
|
const track = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, participantID);
|
|
|
|
|
2020-10-27 15:18:19 +00:00
|
|
|
isScreenSharing = track?.videoType === 'desktop';
|
2020-10-23 22:48:56 +00:00
|
|
|
isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, participantID);
|
2020-10-26 17:58:37 +00:00
|
|
|
isAudioMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.AUDIO, participantID);
|
2020-10-23 22:48:56 +00:00
|
|
|
}
|
|
|
|
|
2020-02-18 16:31:04 +00:00
|
|
|
return {
|
|
|
|
_currentLayout: getCurrentLayout(state),
|
2020-10-26 17:58:37 +00:00
|
|
|
_showAudioMutedIndicator: isAudioMuted,
|
2020-02-18 16:31:04 +00:00
|
|
|
_showModeratorIndicator:
|
2020-10-23 22:48:56 +00:00
|
|
|
!interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR,
|
2020-10-26 19:51:51 +00:00
|
|
|
_showScreenShareIndicator: isScreenSharing,
|
2020-10-23 22:48:56 +00:00
|
|
|
_showVideoMutedIndicator: isVideoMuted
|
2020-02-18 16:31:04 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(_mapStateToProps)(StatusIndicators);
|