|
@@ -1,10 +1,9 @@
|
1
|
|
-import PropTypes from 'prop-types';
|
|
1
|
+// @flow
|
|
2
|
+
|
2
|
3
|
import React, { Component } from 'react';
|
3
|
4
|
import { Text, View } from 'react-native';
|
4
|
5
|
import { connect } from 'react-redux';
|
5
|
6
|
|
6
|
|
-import { prefetch } from '../../../mobile/image-cache';
|
7
|
|
-
|
8
|
7
|
import { translate } from '../../i18n';
|
9
|
8
|
import { JitsiParticipantConnectionStatus } from '../../lib-jitsi-meet';
|
10
|
9
|
import {
|
|
@@ -12,116 +11,117 @@ import {
|
12
|
11
|
shouldRenderVideoTrack,
|
13
|
12
|
VideoTrack
|
14
|
13
|
} from '../../media';
|
|
14
|
+import { prefetch } from '../../../mobile/image-cache';
|
15
|
15
|
import { Container, TintedView } from '../../react';
|
16
|
16
|
import { getTrackByMediaTypeAndParticipant } from '../../tracks';
|
17
|
17
|
|
|
18
|
+import Avatar from './Avatar';
|
18
|
19
|
import {
|
19
|
|
- getAvatarURL, getParticipantById, getParticipantDisplayName
|
|
20
|
+ getAvatarURL,
|
|
21
|
+ getParticipantById,
|
|
22
|
+ getParticipantDisplayName
|
20
|
23
|
} from '../functions';
|
21
|
|
-
|
22
|
|
-import Avatar from './Avatar';
|
23
|
24
|
import styles from './styles';
|
24
|
25
|
|
25
|
26
|
/**
|
26
|
|
- * Implements a React Component which depicts a specific participant's avatar
|
27
|
|
- * and video.
|
28
|
|
- *
|
29
|
|
- * @extends Component
|
|
27
|
+ * The type of the React {@link Component} props of {@link ParticipantView}.
|
30
|
28
|
*/
|
31
|
|
-class ParticipantView extends Component {
|
|
29
|
+type Props = {
|
|
30
|
+
|
32
|
31
|
/**
|
33
|
|
- * ParticipantView component's property types.
|
|
32
|
+ * The indicator which determines whether conferencing is in audio-only
|
|
33
|
+ * mode.
|
34
|
34
|
*
|
35
|
|
- * @static
|
|
35
|
+ * @private
|
36
|
36
|
*/
|
37
|
|
- static propTypes = {
|
38
|
|
- /**
|
39
|
|
- * The indicator which determines whether conferencing is in audio-only
|
40
|
|
- * mode.
|
41
|
|
- *
|
42
|
|
- * @private
|
43
|
|
- */
|
44
|
|
- _audioOnly: PropTypes.bool,
|
45
|
|
-
|
46
|
|
- /**
|
47
|
|
- * The source (e.g. URI, URL) of the avatar image of the participant
|
48
|
|
- * with {@link #participantId}.
|
49
|
|
- *
|
50
|
|
- * @private
|
51
|
|
- */
|
52
|
|
- _avatar: PropTypes.string,
|
53
|
|
-
|
54
|
|
- /**
|
55
|
|
- * The connection status of the participant. Her video will only be
|
56
|
|
- * rendered if the connection status is 'active'; otherwise, the avatar
|
57
|
|
- * will be rendered. If undefined, 'active' is presumed.
|
58
|
|
- *
|
59
|
|
- * @private
|
60
|
|
- */
|
61
|
|
- _connectionStatus: PropTypes.string,
|
62
|
|
-
|
63
|
|
- /**
|
64
|
|
- * The name of the participant which this component represents.
|
65
|
|
- *
|
66
|
|
- * @private
|
67
|
|
- */
|
68
|
|
- _participantName: PropTypes.string,
|
69
|
|
-
|
70
|
|
- /**
|
71
|
|
- * The video Track of the participant with {@link #participantId}.
|
72
|
|
- */
|
73
|
|
- _videoTrack: PropTypes.object,
|
74
|
|
-
|
75
|
|
- /**
|
76
|
|
- * The avatar size.
|
77
|
|
- */
|
78
|
|
- avatarSize: PropTypes.number,
|
79
|
|
-
|
80
|
|
- /**
|
81
|
|
- * The ID of the participant (to be) depicted by ParticipantView.
|
82
|
|
- *
|
83
|
|
- * @public
|
84
|
|
- */
|
85
|
|
- participantId: PropTypes.string,
|
86
|
|
-
|
87
|
|
- /**
|
88
|
|
- * True if the avatar of the depicted participant is to be shown should
|
89
|
|
- * the avatar be available and the video of the participant is not to be
|
90
|
|
- * shown; otherwise, false. If undefined, defaults to true.
|
91
|
|
- */
|
92
|
|
- showAvatar: PropTypes.bool,
|
93
|
|
-
|
94
|
|
- /**
|
95
|
|
- * True if the video of the depicted participant is to be shown should
|
96
|
|
- * the video be available. If undefined, defaults to true.
|
97
|
|
- */
|
98
|
|
- showVideo: PropTypes.bool,
|
99
|
|
-
|
100
|
|
- /**
|
101
|
|
- * The style, if any, to apply to ParticipantView in addition to its
|
102
|
|
- * default style.
|
103
|
|
- */
|
104
|
|
- style: PropTypes.object,
|
105
|
|
-
|
106
|
|
- /**
|
107
|
|
- * The function to translate human-readable text.
|
108
|
|
- */
|
109
|
|
- t: PropTypes.func,
|
110
|
|
-
|
111
|
|
- /**
|
112
|
|
- * Indicates if the connectivity info label should be shown, if
|
113
|
|
- * appropriate. It will be shown in case the connection is interrupted.
|
114
|
|
- */
|
115
|
|
- useConnectivityInfoLabel: PropTypes.bool,
|
116
|
|
-
|
117
|
|
- /**
|
118
|
|
- * The z-order of the Video of ParticipantView in the stacking space of
|
119
|
|
- * all Videos. For more details, refer to the zOrder property of the
|
120
|
|
- * Video class for React Native.
|
121
|
|
- */
|
122
|
|
- zOrder: PropTypes.number
|
123
|
|
- };
|
|
37
|
+ _audioOnly: boolean,
|
|
38
|
+
|
|
39
|
+ /**
|
|
40
|
+ * The source (e.g. URI, URL) of the avatar image of the participant with
|
|
41
|
+ * {@link #participantId}.
|
|
42
|
+ *
|
|
43
|
+ * @private
|
|
44
|
+ */
|
|
45
|
+ _avatar: string,
|
|
46
|
+
|
|
47
|
+ /**
|
|
48
|
+ * The connection status of the participant. Her video will only be rendered
|
|
49
|
+ * if the connection status is 'active'; otherwise, the avatar will be
|
|
50
|
+ * rendered. If undefined, 'active' is presumed.
|
|
51
|
+ *
|
|
52
|
+ * @private
|
|
53
|
+ */
|
|
54
|
+ _connectionStatus: string,
|
|
55
|
+
|
|
56
|
+ /**
|
|
57
|
+ * The name of the participant which this component represents.
|
|
58
|
+ *
|
|
59
|
+ * @private
|
|
60
|
+ */
|
|
61
|
+ _participantName: string,
|
|
62
|
+
|
|
63
|
+ /**
|
|
64
|
+ * The video Track of the participant with {@link #participantId}.
|
|
65
|
+ */
|
|
66
|
+ _videoTrack: Object,
|
124
|
67
|
|
|
68
|
+ /**
|
|
69
|
+ * The avatar size.
|
|
70
|
+ */
|
|
71
|
+ avatarSize: number,
|
|
72
|
+
|
|
73
|
+ /**
|
|
74
|
+ * The ID of the participant (to be) depicted by {@link ParticipantView}.
|
|
75
|
+ *
|
|
76
|
+ * @public
|
|
77
|
+ */
|
|
78
|
+ participantId: string,
|
|
79
|
+
|
|
80
|
+ /**
|
|
81
|
+ * True if the avatar of the depicted participant is to be shown should the
|
|
82
|
+ * avatar be available and the video of the participant is not to be shown;
|
|
83
|
+ * otherwise, false. If undefined, defaults to true.
|
|
84
|
+ */
|
|
85
|
+ showAvatar: boolean,
|
|
86
|
+
|
|
87
|
+ /**
|
|
88
|
+ * True if the video of the depicted participant is to be shown should the
|
|
89
|
+ * video be available. If undefined, defaults to true.
|
|
90
|
+ */
|
|
91
|
+ showVideo: boolean,
|
|
92
|
+
|
|
93
|
+ /**
|
|
94
|
+ * The style, if any, to apply to {@link ParticipantView} in addition to its
|
|
95
|
+ * default style.
|
|
96
|
+ */
|
|
97
|
+ style: Object,
|
|
98
|
+
|
|
99
|
+ /**
|
|
100
|
+ * The function to translate human-readable text.
|
|
101
|
+ */
|
|
102
|
+ t: Function,
|
|
103
|
+
|
|
104
|
+ /**
|
|
105
|
+ * Indicates if the connectivity info label should be shown, if appropriate.
|
|
106
|
+ * It will be shown in case the connection is interrupted.
|
|
107
|
+ */
|
|
108
|
+ useConnectivityInfoLabel: boolean,
|
|
109
|
+
|
|
110
|
+ /**
|
|
111
|
+ * The z-order of the {@link Video} of {@link ParticipantView} in the
|
|
112
|
+ * stacking space of all {@code Video}s. For more details, refer to the
|
|
113
|
+ * {@code zOrder} property of the {@code Video} class for React Native.
|
|
114
|
+ */
|
|
115
|
+ zOrder: number
|
|
116
|
+};
|
|
117
|
+
|
|
118
|
+/**
|
|
119
|
+ * Implements a React Component which depicts a specific participant's avatar
|
|
120
|
+ * and video.
|
|
121
|
+ *
|
|
122
|
+ * @extends Component
|
|
123
|
+ */
|
|
124
|
+class ParticipantView extends Component<Props> {
|
125
|
125
|
/**
|
126
|
126
|
* Renders the connection status label, if appropriate.
|
127
|
127
|
*
|
|
@@ -150,8 +150,8 @@ class ParticipantView extends Component {
|
150
|
150
|
t
|
151
|
151
|
} = this.props;
|
152
|
152
|
|
153
|
|
- // XXX Consider splitting this component into 2: one for the large
|
154
|
|
- // view and one for the thumbnail. Some of these don't apply to both.
|
|
153
|
+ // XXX Consider splitting this component into 2: one for the large view
|
|
154
|
+ // and one for the thumbnail. Some of these don't apply to both.
|
155
|
155
|
const containerStyle = {
|
156
|
156
|
...styles.connectionInfoContainer,
|
157
|
157
|
width: avatarSize * 1.5
|
|
@@ -261,16 +261,18 @@ function _toBoolean(value, undefinedValue) {
|
261
|
261
|
}
|
262
|
262
|
|
263
|
263
|
/**
|
264
|
|
- * Maps (parts of) the Redux state to the associated ParticipantView's props.
|
|
264
|
+ * Maps (parts of) the redux state to the associated {@link ParticipantView}'s
|
|
265
|
+ * props.
|
265
|
266
|
*
|
266
|
|
- * @param {Object} state - The Redux state.
|
267
|
|
- * @param {Object} ownProps - The React Component props passed to the associated
|
268
|
|
- * (instance of) ParticipantView.
|
|
267
|
+ * @param {Object} state - The redux state.
|
|
268
|
+ * @param {Object} ownProps - The React {@code Component} props passed to the
|
|
269
|
+ * associated (instance of) {@code ParticipantView}.
|
269
|
270
|
* @private
|
270
|
271
|
* @returns {{
|
271
|
272
|
* _audioOnly: boolean,
|
272
|
273
|
* _avatar: string,
|
273
|
274
|
* _connectionStatus: string,
|
|
275
|
+ * _participantName: string,
|
274
|
276
|
* _videoTrack: Track
|
275
|
277
|
* }}
|
276
|
278
|
*/
|
|
@@ -287,7 +289,7 @@ function _mapStateToProps(state, ownProps) {
|
287
|
289
|
if (participant) {
|
288
|
290
|
avatar = getAvatarURL(participant);
|
289
|
291
|
connectionStatus = participant.connectionStatus;
|
290
|
|
- participantName = getParticipantDisplayName(state);
|
|
292
|
+ participantName = getParticipantDisplayName(state, participant.id);
|
291
|
293
|
|
292
|
294
|
// Avatar (on React Native) now has the ability to generate an
|
293
|
295
|
// automatically-colored default image when no URI/URL is specified or
|