|
@@ -7,6 +7,7 @@ import { translate } from '../../../base/i18n';
|
7
|
7
|
import { Icon, IconConnectionActive, IconConnectionInactive } from '../../../base/icons';
|
8
|
8
|
import { JitsiParticipantConnectionStatus } from '../../../base/lib-jitsi-meet';
|
9
|
9
|
import { MEDIA_TYPE } from '../../../base/media';
|
|
10
|
+import { getLocalParticipant, getParticipantById } from '../../../base/participants';
|
10
|
11
|
import { Popover } from '../../../base/popover';
|
11
|
12
|
import { connect } from '../../../base/redux';
|
12
|
13
|
import { getTrackByMediaTypeAndParticipant } from '../../../base/tracks';
|
|
@@ -61,6 +62,12 @@ const QUALITY_TO_WIDTH: Array<Object> = [
|
61
|
62
|
*/
|
62
|
63
|
type Props = AbstractProps & {
|
63
|
64
|
|
|
65
|
+ /**
|
|
66
|
+ * The current condition of the user's connection, matching one of the
|
|
67
|
+ * enumerated values in the library.
|
|
68
|
+ */
|
|
69
|
+ _connectionStatus: string,
|
|
70
|
+
|
64
|
71
|
/**
|
65
|
72
|
* Whether or not the component should ignore setting a visibility class for
|
66
|
73
|
* hiding the component when the connection quality is not strong.
|
|
@@ -72,12 +79,6 @@ type Props = AbstractProps & {
|
72
|
79
|
*/
|
73
|
80
|
audioSsrc: number,
|
74
|
81
|
|
75
|
|
- /**
|
76
|
|
- * The current condition of the user's connection, matching one of the
|
77
|
|
- * enumerated values in the library.
|
78
|
|
- */
|
79
|
|
- connectionStatus: string,
|
80
|
|
-
|
81
|
82
|
/**
|
82
|
83
|
* The Redux dispatch function.
|
83
|
84
|
*/
|
|
@@ -200,13 +201,13 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, State> {
|
200
|
201
|
* @returns {string}
|
201
|
202
|
*/
|
202
|
203
|
_getConnectionColorClass() {
|
203
|
|
- const { connectionStatus } = this.props;
|
|
204
|
+ const { _connectionStatus } = this.props;
|
204
|
205
|
const { percent } = this.state.stats;
|
205
|
206
|
const { INACTIVE, INTERRUPTED } = JitsiParticipantConnectionStatus;
|
206
|
207
|
|
207
|
|
- if (connectionStatus === INACTIVE) {
|
|
208
|
+ if (_connectionStatus === INACTIVE) {
|
208
|
209
|
return 'status-other';
|
209
|
|
- } else if (connectionStatus === INTERRUPTED) {
|
|
210
|
+ } else if (_connectionStatus === INTERRUPTED) {
|
210
|
211
|
return 'status-lost';
|
211
|
212
|
} else if (typeof percent === 'undefined') {
|
212
|
213
|
return 'status-high';
|
|
@@ -224,7 +225,7 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, State> {
|
224
|
225
|
_getConnectionStatusTip() {
|
225
|
226
|
let tipKey;
|
226
|
227
|
|
227
|
|
- switch (this.props.connectionStatus) {
|
|
228
|
+ switch (this.props._connectionStatus) {
|
228
|
229
|
case JitsiParticipantConnectionStatus.INTERRUPTED:
|
229
|
230
|
tipKey = 'connectionindicator.quality.lost';
|
230
|
231
|
break;
|
|
@@ -275,12 +276,12 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, State> {
|
275
|
276
|
* @returns {string}
|
276
|
277
|
*/
|
277
|
278
|
_getVisibilityClass() {
|
278
|
|
- const { connectionStatus } = this.props;
|
|
279
|
+ const { _connectionStatus } = this.props;
|
279
|
280
|
|
280
|
281
|
return this.state.showIndicator
|
281
|
282
|
|| this.props.alwaysVisible
|
282
|
|
- || connectionStatus === JitsiParticipantConnectionStatus.INTERRUPTED
|
283
|
|
- || connectionStatus === JitsiParticipantConnectionStatus.INACTIVE
|
|
283
|
+ || _connectionStatus === JitsiParticipantConnectionStatus.INTERRUPTED
|
|
284
|
+ || _connectionStatus === JitsiParticipantConnectionStatus.INACTIVE
|
284
|
285
|
? 'show-connection-indicator' : 'hide-connection-indicator';
|
285
|
286
|
}
|
286
|
287
|
|
|
@@ -304,7 +305,7 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, State> {
|
304
|
305
|
* @returns {ReactElement}
|
305
|
306
|
*/
|
306
|
307
|
_renderIcon() {
|
307
|
|
- if (this.props.connectionStatus
|
|
308
|
+ if (this.props._connectionStatus
|
308
|
309
|
=== JitsiParticipantConnectionStatus.INACTIVE) {
|
309
|
310
|
return (
|
310
|
311
|
<span className = 'connection_ninja'>
|
|
@@ -319,7 +320,7 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, State> {
|
319
|
320
|
let iconWidth;
|
320
|
321
|
let emptyIconWrapperClassName = 'connection_empty';
|
321
|
322
|
|
322
|
|
- if (this.props.connectionStatus
|
|
323
|
+ if (this.props._connectionStatus
|
323
|
324
|
=== JitsiParticipantConnectionStatus.INTERRUPTED) {
|
324
|
325
|
|
325
|
326
|
// emptyIconWrapperClassName is used by the torture tests to
|
|
@@ -434,21 +435,29 @@ export function _mapDispatchToProps(dispatch: Dispatch<any>) {
|
434
|
435
|
* @returns {Props}
|
435
|
436
|
*/
|
436
|
437
|
export function _mapStateToProps(state: Object, ownProps: Props) {
|
437
|
|
-
|
|
438
|
+ const { participantId } = ownProps;
|
438
|
439
|
const conference = state['features/base/conference'].conference;
|
|
440
|
+ const participant
|
|
441
|
+ = typeof participantId === 'undefined' ? getLocalParticipant(state) : getParticipantById(state, participantId);
|
|
442
|
+ const props = {
|
|
443
|
+ _connectionStatus: participant?.connectionStatus
|
|
444
|
+ };
|
439
|
445
|
|
440
|
446
|
if (conference) {
|
441
|
447
|
const firstVideoTrack = getTrackByMediaTypeAndParticipant(
|
442
|
|
- state['features/base/tracks'], MEDIA_TYPE.VIDEO, ownProps.participantId);
|
|
448
|
+ state['features/base/tracks'], MEDIA_TYPE.VIDEO, participantId);
|
443
|
449
|
const firstAudioTrack = getTrackByMediaTypeAndParticipant(
|
444
|
|
- state['features/base/tracks'], MEDIA_TYPE.AUDIO, ownProps.participantId);
|
|
450
|
+ state['features/base/tracks'], MEDIA_TYPE.AUDIO, participantId);
|
445
|
451
|
|
446
|
452
|
return {
|
|
453
|
+ ...props,
|
447
|
454
|
audioSsrc: firstAudioTrack ? conference.getSsrcByTrack(firstAudioTrack.jitsiTrack) : undefined,
|
448
|
455
|
videoSsrc: firstVideoTrack ? conference.getSsrcByTrack(firstVideoTrack.jitsiTrack) : undefined
|
449
|
456
|
};
|
450
|
457
|
}
|
451
|
458
|
|
452
|
|
- return {};
|
|
459
|
+ return {
|
|
460
|
+ ...props
|
|
461
|
+ };
|
453
|
462
|
}
|
454
|
463
|
export default translate(connect(_mapStateToProps, _mapDispatchToProps)(ConnectionIndicator));
|