|
@@ -45,74 +45,61 @@ export default class JitsiParticipant {
|
45
|
45
|
this._features = new Set();
|
46
|
46
|
}
|
47
|
47
|
|
48
|
|
- /* eslint-enable max-params */
|
49
|
|
-
|
50
|
48
|
/**
|
51
|
|
- * @returns {JitsiConference} The conference that this participant belongs
|
52
|
|
- * to.
|
|
49
|
+ * Determines whether all JitsiTracks which are of a specific MediaType and which belong to this
|
|
50
|
+ * JitsiParticipant are muted.
|
|
51
|
+ *
|
|
52
|
+ * @param {MediaType} mediaType - The MediaType of the JitsiTracks to be checked.
|
|
53
|
+ * @private
|
|
54
|
+ * @returns {Boolean} True if all JitsiTracks which are of the specified mediaType and which belong to this
|
|
55
|
+ * JitsiParticipant are muted; otherwise, false.
|
53
|
56
|
*/
|
54
|
|
- getConference() {
|
55
|
|
- return this._conference;
|
|
57
|
+ _isMediaTypeMuted(mediaType) {
|
|
58
|
+ return this.getTracks().reduce(
|
|
59
|
+ (muted, track) =>
|
|
60
|
+ muted && (track.getType() !== mediaType || track.isMuted()),
|
|
61
|
+ true);
|
56
|
62
|
}
|
57
|
63
|
|
58
|
64
|
/**
|
59
|
|
- * Gets the value of a property of this participant.
|
|
65
|
+ * Returns the bot type for the participant.
|
|
66
|
+ *
|
|
67
|
+ * @returns {string|undefined} - The bot type of the participant.
|
60
|
68
|
*/
|
61
|
|
- getProperty(name) {
|
62
|
|
- return this._properties[name];
|
|
69
|
+ getBotType() {
|
|
70
|
+ return this._botType;
|
63
|
71
|
}
|
64
|
72
|
|
65
|
73
|
/**
|
66
|
|
- * Checks whether this <tt>JitsiParticipant</tt> has any video tracks which
|
67
|
|
- * are muted according to their underlying WebRTC <tt>MediaStreamTrack</tt>
|
68
|
|
- * muted status.
|
69
|
|
- * @return {boolean} <tt>true</tt> if this <tt>participant</tt> contains any
|
70
|
|
- * video <tt>JitsiTrack</tt>s which are muted as defined in
|
71
|
|
- * {@link JitsiTrack.isWebRTCTrackMuted}.
|
|
74
|
+ * @returns {JitsiConference} The conference that this participant belongs
|
|
75
|
+ * to.
|
72
|
76
|
*/
|
73
|
|
- hasAnyVideoTrackWebRTCMuted() {
|
74
|
|
- return (
|
75
|
|
- this.getTracks().some(
|
76
|
|
- jitsiTrack =>
|
77
|
|
- jitsiTrack.getType() === MediaType.VIDEO
|
78
|
|
- && jitsiTrack.isWebRTCTrackMuted()));
|
|
77
|
+ getConference() {
|
|
78
|
+ return this._conference;
|
79
|
79
|
}
|
80
|
80
|
|
81
|
81
|
/**
|
82
|
|
- * Sets the value of a property of this participant, and fires an event if
|
83
|
|
- * the value has changed.
|
84
|
|
- * @name the name of the property.
|
85
|
|
- * @value the value to set.
|
|
82
|
+ * Returns the connection jid for the participant.
|
|
83
|
+ *
|
|
84
|
+ * @returns {string|undefined} - The connection jid of the participant.
|
86
|
85
|
*/
|
87
|
|
- setProperty(name, value) {
|
88
|
|
- const oldValue = this._properties[name];
|
89
|
|
-
|
90
|
|
- if (value !== oldValue) {
|
91
|
|
- this._properties[name] = value;
|
92
|
|
- this._conference.eventEmitter.emit(
|
93
|
|
- JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
|
94
|
|
- this,
|
95
|
|
- name,
|
96
|
|
- oldValue,
|
97
|
|
- value);
|
98
|
|
- }
|
|
86
|
+ getConnectionJid() {
|
|
87
|
+ return this._connectionJid;
|
99
|
88
|
}
|
100
|
89
|
|
101
|
90
|
/**
|
102
|
|
- * @returns {Array.<JitsiTrack>} The list of media tracks for this
|
103
|
|
- * participant.
|
|
91
|
+ * @returns {String} The human-readable display name of this participant.
|
104
|
92
|
*/
|
105
|
|
- getTracks() {
|
106
|
|
- return this._tracks.slice();
|
|
93
|
+ getDisplayName() {
|
|
94
|
+ return this._displayName;
|
107
|
95
|
}
|
108
|
96
|
|
109
|
97
|
/**
|
110
|
|
- * @param {MediaType} mediaType
|
111
|
|
- * @returns {Array.<JitsiTrack>} an array of media tracks for this
|
112
|
|
- * participant, for given media type.
|
|
98
|
+ * Returns a set with the features for the participant.
|
|
99
|
+ * @returns {Promise<Set<String>, Error>}
|
113
|
100
|
*/
|
114
|
|
- getTracksByMediaType(mediaType) {
|
115
|
|
- return this.getTracks().filter(track => track.getType() === mediaType);
|
|
101
|
+ getFeatures() {
|
|
102
|
+ return Promise.resolve(this._features);
|
116
|
103
|
}
|
117
|
104
|
|
118
|
105
|
/**
|
|
@@ -130,10 +117,17 @@ export default class JitsiParticipant {
|
130
|
117
|
}
|
131
|
118
|
|
132
|
119
|
/**
|
133
|
|
- * @returns {String} The human-readable display name of this participant.
|
|
120
|
+ * Gets the value of a property of this participant.
|
134
|
121
|
*/
|
135
|
|
- getDisplayName() {
|
136
|
|
- return this._displayName;
|
|
122
|
+ getProperty(name) {
|
|
123
|
+ return this._properties[name];
|
|
124
|
+ }
|
|
125
|
+
|
|
126
|
+ /**
|
|
127
|
+ * @returns {String} The role of this participant.
|
|
128
|
+ */
|
|
129
|
+ getRole() {
|
|
130
|
+ return this._role;
|
137
|
131
|
}
|
138
|
132
|
|
139
|
133
|
/**
|
|
@@ -151,10 +145,37 @@ export default class JitsiParticipant {
|
151
|
145
|
}
|
152
|
146
|
|
153
|
147
|
/**
|
154
|
|
- * @returns {Boolean} Whether this participant is a moderator or not.
|
|
148
|
+ * @returns {Array.<JitsiTrack>} The list of media tracks for this
|
|
149
|
+ * participant.
|
155
|
150
|
*/
|
156
|
|
- isModerator() {
|
157
|
|
- return this._role === 'moderator';
|
|
151
|
+ getTracks() {
|
|
152
|
+ return this._tracks.slice();
|
|
153
|
+ }
|
|
154
|
+
|
|
155
|
+ /**
|
|
156
|
+ * @param {MediaType} mediaType
|
|
157
|
+ * @returns {Array.<JitsiTrack>} an array of media tracks for this
|
|
158
|
+ * participant, for given media type.
|
|
159
|
+ */
|
|
160
|
+ getTracksByMediaType(mediaType) {
|
|
161
|
+ return this.getTracks().filter(track => track.getType() === mediaType);
|
|
162
|
+ }
|
|
163
|
+
|
|
164
|
+ /**
|
|
165
|
+ * Checks current set features.
|
|
166
|
+ * @param {String} feature - the feature to check.
|
|
167
|
+ * @return {boolean} <tt>true</tt> if this <tt>participant</tt> contains the
|
|
168
|
+ * <tt>feature</tt>.
|
|
169
|
+ */
|
|
170
|
+ hasFeature(feature) {
|
|
171
|
+ return this._features.has(feature);
|
|
172
|
+ }
|
|
173
|
+
|
|
174
|
+ /**
|
|
175
|
+ * @returns {Boolean} Whether this participant has muted their audio.
|
|
176
|
+ */
|
|
177
|
+ isAudioMuted() {
|
|
178
|
+ return this._isMediaTypeMuted(MediaType.AUDIO);
|
158
|
179
|
}
|
159
|
180
|
|
160
|
181
|
/**
|
|
@@ -176,11 +197,10 @@ export default class JitsiParticipant {
|
176
|
197
|
}
|
177
|
198
|
|
178
|
199
|
/**
|
179
|
|
- * @returns {Boolean} Whether this participant replaces another participant
|
180
|
|
- * from the meeting.
|
|
200
|
+ * @returns {Boolean} Whether this participant is a moderator or not.
|
181
|
201
|
*/
|
182
|
|
- isReplacing() {
|
183
|
|
- return this._isReplacing;
|
|
202
|
+ isModerator() {
|
|
203
|
+ return this._role === 'moderator';
|
184
|
204
|
}
|
185
|
205
|
|
186
|
206
|
/**
|
|
@@ -192,28 +212,11 @@ export default class JitsiParticipant {
|
192
|
212
|
}
|
193
|
213
|
|
194
|
214
|
/**
|
195
|
|
- * @returns {Boolean} Whether this participant has muted their audio.
|
196
|
|
- */
|
197
|
|
- isAudioMuted() {
|
198
|
|
- return this._isMediaTypeMuted(MediaType.AUDIO);
|
199
|
|
- }
|
200
|
|
-
|
201
|
|
- /**
|
202
|
|
- * Determines whether all JitsiTracks which are of a specific MediaType and
|
203
|
|
- * which belong to this JitsiParticipant are muted.
|
204
|
|
- *
|
205
|
|
- * @param {MediaType} mediaType - The MediaType of the JitsiTracks to be
|
206
|
|
- * checked.
|
207
|
|
- * @private
|
208
|
|
- * @returns {Boolean} True if all JitsiTracks which are of the specified
|
209
|
|
- * mediaType and which belong to this JitsiParticipant are muted; otherwise,
|
210
|
|
- * false.
|
|
215
|
+ * @returns {Boolean} Whether this participant replaces another participant
|
|
216
|
+ * from the meeting.
|
211
|
217
|
*/
|
212
|
|
- _isMediaTypeMuted(mediaType) {
|
213
|
|
- return this.getTracks().reduce(
|
214
|
|
- (muted, track) =>
|
215
|
|
- muted && (track.getType() !== mediaType || track.isMuted()),
|
216
|
|
- true);
|
|
218
|
+ isReplacing() {
|
|
219
|
+ return this._isReplacing;
|
217
|
220
|
}
|
218
|
221
|
|
219
|
222
|
/**
|
|
@@ -224,26 +227,27 @@ export default class JitsiParticipant {
|
224
|
227
|
}
|
225
|
228
|
|
226
|
229
|
/**
|
227
|
|
- * @returns {String} The role of this participant.
|
|
230
|
+ * Sets the bot type for the participant.
|
|
231
|
+ * @param {String} newBotType - The new bot type to set.
|
228
|
232
|
*/
|
229
|
|
- getRole() {
|
230
|
|
- return this._role;
|
|
233
|
+ setBotType(newBotType) {
|
|
234
|
+ this._botType = newBotType;
|
231
|
235
|
}
|
232
|
236
|
|
233
|
237
|
/**
|
234
|
|
- * Sets a new participant role.
|
235
|
|
- * @param {String} newRole - the new role.
|
|
238
|
+ * Sets the connection jid for the participant.
|
|
239
|
+ * @param {String} newJid - The connection jid to set.
|
236
|
240
|
*/
|
237
|
|
- setRole(newRole) {
|
238
|
|
- this._role = newRole;
|
|
241
|
+ setConnectionJid(newJid) {
|
|
242
|
+ this._connectionJid = newJid;
|
239
|
243
|
}
|
240
|
244
|
|
241
|
245
|
/**
|
242
|
|
- * Sets whether participant is replacing another based on jwt.
|
243
|
|
- * @param {String} newIsReplacing - whether is replacing.
|
|
246
|
+ * Set new features.
|
|
247
|
+ * @param {Set<String>|undefined} newFeatures - Sets new features.
|
244
|
248
|
*/
|
245
|
|
- setIsReplacing(newIsReplacing) {
|
246
|
|
- this._isReplacing = newIsReplacing;
|
|
249
|
+ setFeatures(newFeatures) {
|
|
250
|
+ this._features = newFeatures || new Set();
|
247
|
251
|
}
|
248
|
252
|
|
249
|
253
|
/**
|
|
@@ -255,69 +259,45 @@ export default class JitsiParticipant {
|
255
|
259
|
}
|
256
|
260
|
|
257
|
261
|
/**
|
258
|
|
- *
|
259
|
|
- */
|
260
|
|
- supportsDTMF() {
|
261
|
|
- return this._supportsDTMF;
|
262
|
|
- }
|
263
|
|
-
|
264
|
|
- /**
|
265
|
|
- * Returns a set with the features for the participant.
|
266
|
|
- * @returns {Promise<Set<String>, Error>}
|
267
|
|
- */
|
268
|
|
- getFeatures() {
|
269
|
|
- return Promise.resolve(this._features);
|
270
|
|
- }
|
271
|
|
-
|
272
|
|
- /**
|
273
|
|
- * Checks current set features.
|
274
|
|
- * @param {String} feature - the feature to check.
|
275
|
|
- * @return {boolean} <tt>true</tt> if this <tt>participant</tt> contains the
|
276
|
|
- * <tt>feature</tt>.
|
|
262
|
+ * Sets whether participant is replacing another based on jwt.
|
|
263
|
+ * @param {String} newIsReplacing - whether is replacing.
|
277
|
264
|
*/
|
278
|
|
- hasFeature(feature) {
|
279
|
|
- return this._features.has(feature);
|
|
265
|
+ setIsReplacing(newIsReplacing) {
|
|
266
|
+ this._isReplacing = newIsReplacing;
|
280
|
267
|
}
|
281
|
268
|
|
282
|
269
|
/**
|
283
|
|
- * Set new features.
|
284
|
|
- * @param {Set<String>|undefined} newFeatures - Sets new features.
|
|
270
|
+ * Sets the value of a property of this participant, and fires an event if
|
|
271
|
+ * the value has changed.
|
|
272
|
+ * @name the name of the property.
|
|
273
|
+ * @value the value to set.
|
285
|
274
|
*/
|
286
|
|
- setFeatures(newFeatures) {
|
287
|
|
- this._features = newFeatures || new Set();
|
288
|
|
- }
|
|
275
|
+ setProperty(name, value) {
|
|
276
|
+ const oldValue = this._properties[name];
|
289
|
277
|
|
290
|
|
- /**
|
291
|
|
- * Returns the bot type for the participant.
|
292
|
|
- *
|
293
|
|
- * @returns {string|undefined} - The bot type of the participant.
|
294
|
|
- */
|
295
|
|
- getBotType() {
|
296
|
|
- return this._botType;
|
|
278
|
+ if (value !== oldValue) {
|
|
279
|
+ this._properties[name] = value;
|
|
280
|
+ this._conference.eventEmitter.emit(
|
|
281
|
+ JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
|
|
282
|
+ this,
|
|
283
|
+ name,
|
|
284
|
+ oldValue,
|
|
285
|
+ value);
|
|
286
|
+ }
|
297
|
287
|
}
|
298
|
288
|
|
299
|
289
|
/**
|
300
|
|
- * Sets the bot type for the participant.
|
301
|
|
- * @param {String} newBotType - The new bot type to set.
|
|
290
|
+ * Sets a new participant role.
|
|
291
|
+ * @param {String} newRole - the new role.
|
302
|
292
|
*/
|
303
|
|
- setBotType(newBotType) {
|
304
|
|
- this._botType = newBotType;
|
|
293
|
+ setRole(newRole) {
|
|
294
|
+ this._role = newRole;
|
305
|
295
|
}
|
306
|
296
|
|
307
|
297
|
/**
|
308
|
|
- * Returns the connection jid for the participant.
|
309
|
298
|
*
|
310
|
|
- * @returns {string|undefined} - The connection jid of the participant.
|
311
|
|
- */
|
312
|
|
- getConnectionJid() {
|
313
|
|
- return this._connectionJid;
|
314
|
|
- }
|
315
|
|
-
|
316
|
|
- /**
|
317
|
|
- * Sets the connection jid for the participant.
|
318
|
|
- * @param {String} newJid - The connection jid to set.
|
319
|
299
|
*/
|
320
|
|
- setConnectionJid(newJid) {
|
321
|
|
- this._connectionJid = newJid;
|
|
300
|
+ supportsDTMF() {
|
|
301
|
+ return this._supportsDTMF;
|
322
|
302
|
}
|
323
|
303
|
}
|