fix(connection-indicator) Fix detecting local/remote participant

This commit is contained in:
hmuresan 2021-07-08 14:19:17 +03:00 committed by Horatiu Muresan
parent d72b27d46d
commit f2f545a57f
3 changed files with 47 additions and 45 deletions

View File

@ -92,11 +92,6 @@ type Props = AbstractProps & {
*/ */
iconSize: number, iconSize: number,
/**
* Whether or not the displays stats are for local video.
*/
isLocalVideo: boolean,
/** /**
* Relative to the icon from where the popover for more connection details * Relative to the icon from where the popover for more connection details
* should display. * should display.
@ -149,7 +144,9 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, AbstractSta
return ( return (
<Popover <Popover
className = { rootClassNames } className = { rootClassNames }
content = { <ConnectionIndicatorContent participantId = { this.props.participantId } /> } content = { <ConnectionIndicatorContent
inheritedStats = { this.state.stats }
participantId = { this.props.participantId } /> }
disablePopover = { !this.props.enableStatsDisplay } disablePopover = { !this.props.enableStatsDisplay }
position = { this.props.statsPopoverPosition }> position = { this.props.statsPopoverPosition }>
<div className = 'popover-trigger'> <div className = 'popover-trigger'>

View File

@ -58,6 +58,11 @@ const QUALITY_TO_WIDTH: Array<Object> = [
*/ */
type Props = AbstractProps & { type Props = AbstractProps & {
/**
* The audio SSRC of this client.
*/
_audioSsrc: number,
/** /**
* The current condition of the user's connection, matching one of the * The current condition of the user's connection, matching one of the
* enumerated values in the library. * enumerated values in the library.
@ -65,9 +70,31 @@ type Props = AbstractProps & {
_connectionStatus: string, _connectionStatus: string,
/** /**
* The audio SSRC of this client. * Whether or not should display the "Show More" link in the local video
* stats table.
*/ */
audioSsrc: number, _disableShowMoreStats: boolean,
/**
* Whether or not should display the "Save Logs" link in the local video
* stats table.
*/
_enableSaveLogs: boolean,
/**
* Whether or not the displays stats are for local video.
*/
_isLocalVideo: boolean,
/**
* Invoked to save the conference logs.
*/
_onSaveLogs: Function,
/**
* The video SSRC of this client.
*/
_videoSsrc: number,
/** /**
* Css class to apply on container * Css class to apply on container
@ -80,36 +107,14 @@ type Props = AbstractProps & {
dispatch: Dispatch<any>, dispatch: Dispatch<any>,
/** /**
* Whether or not should display the "Show More" link in the local video * Optional param for passing existing connection stats on component instantiation
* stats table.
*/ */
disableShowMoreStats: boolean, inheritedStats: Object,
/**
* Whether or not should display the "Save Logs" link in the local video
* stats table.
*/
enableSaveLogs: boolean,
/**
* Whether or not the displays stats are for local video.
*/
isLocalVideo: boolean,
/** /**
* Invoked to obtain translated strings. * Invoked to obtain translated strings.
*/ */
t: Function, t: Function
/**
* The video SSRC of this client.
*/
videoSsrc: number,
/**
* Invoked to save the conference logs.
*/
_onSaveLogs: Function
}; };
/** /**
@ -143,7 +148,7 @@ class ConnectionIndicatorContent extends AbstractConnectionIndicator<Props, Stat
autoHideTimeout: undefined, autoHideTimeout: undefined,
showIndicator: false, showIndicator: false,
showMoreStats: false, showMoreStats: false,
stats: {} stats: props.inheritedStats || {}
}; };
// Bind event handlers so they are only bound once for every instance. // Bind event handlers so they are only bound once for every instance.
@ -174,17 +179,17 @@ class ConnectionIndicatorContent extends AbstractConnectionIndicator<Props, Stat
return ( return (
<ConnectionStatsTable <ConnectionStatsTable
audioSsrc = { this.props.audioSsrc } audioSsrc = { this.props._audioSsrc }
bandwidth = { bandwidth } bandwidth = { bandwidth }
bitrate = { bitrate } bitrate = { bitrate }
bridgeCount = { bridgeCount } bridgeCount = { bridgeCount }
codec = { codec } codec = { codec }
connectionSummary = { this._getConnectionStatusTip() } connectionSummary = { this._getConnectionStatusTip() }
disableShowMoreStats = { this.props.disableShowMoreStats } disableShowMoreStats = { this.props._disableShowMoreStats }
e2eRtt = { e2eRtt } e2eRtt = { e2eRtt }
enableSaveLogs = { this.props.enableSaveLogs } enableSaveLogs = { this.props._enableSaveLogs }
framerate = { framerate } framerate = { framerate }
isLocalVideo = { this.props.isLocalVideo } isLocalVideo = { this.props._isLocalVideo }
maxEnabledResolution = { maxEnabledResolution } maxEnabledResolution = { maxEnabledResolution }
onSaveLogs = { this.props._onSaveLogs } onSaveLogs = { this.props._onSaveLogs }
onShowMore = { this._onToggleShowMore } onShowMore = { this._onToggleShowMore }
@ -195,7 +200,7 @@ class ConnectionIndicatorContent extends AbstractConnectionIndicator<Props, Stat
serverRegion = { serverRegion } serverRegion = { serverRegion }
shouldShowMore = { this.state.showMoreStats } shouldShowMore = { this.state.showMoreStats }
transport = { transport } transport = { transport }
videoSsrc = { this.props.videoSsrc } /> videoSsrc = { this.props._videoSsrc } />
); );
} }
@ -303,8 +308,9 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
= participantId ? getParticipantById(state, participantId) : getLocalParticipant(state); = participantId ? getParticipantById(state, participantId) : getLocalParticipant(state);
const props = { const props = {
_connectionStatus: participant?.connectionStatus, _connectionStatus: participant?.connectionStatus,
enableSaveLogs: state['features/base/config'].enableSaveLogs, _enableSaveLogs: state['features/base/config'].enableSaveLogs,
disableShowMoreStats: state['features/base/config'].disableShowMoreStats _disableShowMoreStats: state['features/base/config'].disableShowMoreStats,
_isLocalVideo: participant?.local
}; };
if (conference) { if (conference) {
@ -315,8 +321,8 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
return { return {
...props, ...props,
audioSsrc: firstAudioTrack ? conference.getSsrcByTrack(firstAudioTrack.jitsiTrack) : undefined, _audioSsrc: firstAudioTrack ? conference.getSsrcByTrack(firstAudioTrack.jitsiTrack) : undefined,
videoSsrc: firstVideoTrack ? conference.getSsrcByTrack(firstVideoTrack.jitsiTrack) : undefined _videoSsrc: firstVideoTrack ? conference.getSsrcByTrack(firstVideoTrack.jitsiTrack) : undefined
}; };
} }

View File

@ -652,7 +652,7 @@ class Thumbnail extends Component<Props, State> {
} = this.props; } = this.props;
const { isHovered } = this.state; const { isHovered } = this.state;
const showConnectionIndicator = isHovered || !_connectionIndicatorAutoHideEnabled; const showConnectionIndicator = isHovered || !_connectionIndicatorAutoHideEnabled;
const { id, local = false, dominantSpeaker = false } = _participant; const { id, dominantSpeaker = false } = _participant;
const showDominantSpeaker = !_isDominantSpeakerDisabled && dominantSpeaker; const showDominantSpeaker = !_isDominantSpeakerDisabled && dominantSpeaker;
let statsPopoverPosition, tooltipPosition; let statsPopoverPosition, tooltipPosition;
@ -677,7 +677,6 @@ class Thumbnail extends Component<Props, State> {
alwaysVisible = { showConnectionIndicator } alwaysVisible = { showConnectionIndicator }
enableStatsDisplay = { true } enableStatsDisplay = { true }
iconSize = { iconSize } iconSize = { iconSize }
isLocalVideo = { local }
participantId = { id } participantId = { id }
statsPopoverPosition = { statsPopoverPosition } /> statsPopoverPosition = { statsPopoverPosition } />
} }