|
@@ -1,7 +1,6 @@
|
1
|
1
|
import { getLogger } from '@jitsi/logger';
|
2
|
2
|
|
3
|
3
|
import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
|
4
|
|
-import BridgeVideoType from '../../service/RTC/BridgeVideoType';
|
5
|
4
|
import { MediaType } from '../../service/RTC/MediaType';
|
6
|
5
|
import RTCEvents from '../../service/RTC/RTCEvents';
|
7
|
6
|
import browser from '../browser';
|
|
@@ -116,14 +115,6 @@ export default class RTC extends Listenable {
|
116
|
115
|
*/
|
117
|
116
|
this._lastN = undefined;
|
118
|
117
|
|
119
|
|
- /**
|
120
|
|
- * Defines the last N endpoints list. It can be null or an array once
|
121
|
|
- * initialised with a channel last N event.
|
122
|
|
- * @type {Array<string>|null}
|
123
|
|
- * @private
|
124
|
|
- */
|
125
|
|
- this._lastNEndpoints = null;
|
126
|
|
-
|
127
|
118
|
/**
|
128
|
119
|
* Defines the forwarded sources list. It can be null or an array once initialised with a channel forwarded
|
129
|
120
|
* sources event.
|
|
@@ -133,37 +124,11 @@ export default class RTC extends Listenable {
|
133
|
124
|
*/
|
134
|
125
|
this._forwardedSources = null;
|
135
|
126
|
|
136
|
|
- /**
|
137
|
|
- * The number representing the maximum video height the local client
|
138
|
|
- * should receive from the bridge.
|
139
|
|
- *
|
140
|
|
- * @type {number|undefined}
|
141
|
|
- * @private
|
142
|
|
- */
|
143
|
|
- this._maxFrameHeight = undefined;
|
144
|
|
-
|
145
|
|
- /**
|
146
|
|
- * The endpoint IDs of currently selected participants.
|
147
|
|
- *
|
148
|
|
- * @type {Array}
|
149
|
|
- * @private
|
150
|
|
- */
|
151
|
|
- this._selectedEndpoints = null;
|
152
|
|
-
|
153
|
127
|
// The forwarded sources change listener.
|
154
|
128
|
this._forwardedSourcesChangeListener = this._onForwardedSourcesChanged.bind(this);
|
155
|
129
|
|
156
|
130
|
this._onDeviceListChanged = this._onDeviceListChanged.bind(this);
|
157
|
|
- this._updateAudioOutputForAudioTracks
|
158
|
|
- = this._updateAudioOutputForAudioTracks.bind(this);
|
159
|
|
-
|
160
|
|
- /**
|
161
|
|
- * The default video type assumed by the bridge.
|
162
|
|
- * @deprecated this will go away with multiple streams support
|
163
|
|
- * @type {BridgeVideoType}
|
164
|
|
- * @private
|
165
|
|
- */
|
166
|
|
- this._videoType = BridgeVideoType.NONE;
|
|
131
|
+ this._updateAudioOutputForAudioTracks = this._updateAudioOutputForAudioTracks.bind(this);
|
167
|
132
|
|
168
|
133
|
// Switch audio output device on all remote audio tracks. Local audio
|
169
|
134
|
// tracks handle this event by themselves.
|
|
@@ -240,25 +205,11 @@ export default class RTC extends Listenable {
|
240
|
205
|
// simulcast, we want the notification to trigger even if userJid is undefined, or null.
|
241
|
206
|
if (this._receiverVideoConstraints) {
|
242
|
207
|
try {
|
243
|
|
- this._channel.sendNewReceiverVideoConstraintsMessage(this._receiverVideoConstraints);
|
|
208
|
+ this._channel.sendReceiverVideoConstraintsMessage(this._receiverVideoConstraints);
|
244
|
209
|
} catch (error) {
|
245
|
210
|
logError(error, 'ReceiverVideoConstraints', this._receiverVideoConstraints);
|
246
|
211
|
}
|
247
|
212
|
}
|
248
|
|
- if (this._selectedEndpoints) {
|
249
|
|
- try {
|
250
|
|
- this._channel.sendSelectedEndpointsMessage(this._selectedEndpoints);
|
251
|
|
- } catch (error) {
|
252
|
|
- logError(error, 'SelectedEndpointsChangedEvent', this._selectedEndpoints);
|
253
|
|
- }
|
254
|
|
- }
|
255
|
|
- if (typeof this._maxFrameHeight !== 'undefined') {
|
256
|
|
- try {
|
257
|
|
- this._channel.sendReceiverVideoConstraintMessage(this._maxFrameHeight);
|
258
|
|
- } catch (error) {
|
259
|
|
- logError(error, 'ReceiverVideoConstraint', this._maxFrameHeight);
|
260
|
|
- }
|
261
|
|
- }
|
262
|
213
|
if (typeof this._lastN !== 'undefined' && this._lastN !== -1) {
|
263
|
214
|
try {
|
264
|
215
|
this._channel.sendSetLastNMessage(this._lastN);
|
|
@@ -348,45 +299,11 @@ export default class RTC extends Listenable {
|
348
|
299
|
* is established.
|
349
|
300
|
* @param {*} constraints
|
350
|
301
|
*/
|
351
|
|
- setNewReceiverVideoConstraints(constraints) {
|
|
302
|
+ setReceiverVideoConstraints(constraints) {
|
352
|
303
|
this._receiverVideoConstraints = constraints;
|
353
|
304
|
|
354
|
305
|
if (this._channel && this._channel.isOpen()) {
|
355
|
|
- this._channel.sendNewReceiverVideoConstraintsMessage(constraints);
|
356
|
|
- }
|
357
|
|
- }
|
358
|
|
-
|
359
|
|
- /**
|
360
|
|
- * Sets the maximum video size the local participant should receive from
|
361
|
|
- * remote participants. Will cache the value and send it through the channel
|
362
|
|
- * once it is created.
|
363
|
|
- *
|
364
|
|
- * @param {number} maxFrameHeightPixels the maximum frame height, in pixels,
|
365
|
|
- * this receiver is willing to receive.
|
366
|
|
- * @returns {void}
|
367
|
|
- */
|
368
|
|
- setReceiverVideoConstraint(maxFrameHeight) {
|
369
|
|
- this._maxFrameHeight = maxFrameHeight;
|
370
|
|
-
|
371
|
|
- if (this._channel && this._channel.isOpen()) {
|
372
|
|
- this._channel.sendReceiverVideoConstraintMessage(maxFrameHeight);
|
373
|
|
- }
|
374
|
|
- }
|
375
|
|
-
|
376
|
|
- /**
|
377
|
|
- * Sets the video type and availability for the local video source.
|
378
|
|
- *
|
379
|
|
- * @param {string} videoType 'camera' for camera, 'desktop' for screenshare and
|
380
|
|
- * 'none' for when local video source is muted or removed from the peerconnection.
|
381
|
|
- * @returns {void}
|
382
|
|
- */
|
383
|
|
- setVideoType(videoType) {
|
384
|
|
- if (this._videoType !== videoType) {
|
385
|
|
- this._videoType = videoType;
|
386
|
|
-
|
387
|
|
- if (this._channel && this._channel.isOpen()) {
|
388
|
|
- this._channel.sendVideoTypeMessage(videoType);
|
389
|
|
- }
|
|
306
|
+ this._channel.sendReceiverVideoConstraintsMessage(constraints);
|
390
|
307
|
}
|
391
|
308
|
}
|
392
|
309
|
|
|
@@ -401,25 +318,6 @@ export default class RTC extends Listenable {
|
401
|
318
|
}
|
402
|
319
|
}
|
403
|
320
|
|
404
|
|
- /**
|
405
|
|
- * Elects the participants with the given ids to be the selected
|
406
|
|
- * participants in order to always receive video for this participant (even
|
407
|
|
- * when last n is enabled). If there is no channel we store it and send it
|
408
|
|
- * through the channel once it is created.
|
409
|
|
- *
|
410
|
|
- * @param {Array<string>} ids - The user ids.
|
411
|
|
- * @throws NetworkError or InvalidStateError or Error if the operation
|
412
|
|
- * fails.
|
413
|
|
- * @returns {void}
|
414
|
|
- */
|
415
|
|
- selectEndpoints(ids) {
|
416
|
|
- this._selectedEndpoints = ids;
|
417
|
|
-
|
418
|
|
- if (this._channel && this._channel.isOpen()) {
|
419
|
|
- this._channel.sendSelectedEndpointsMessage(ids);
|
420
|
|
- }
|
421
|
|
- }
|
422
|
|
-
|
423
|
321
|
/**
|
424
|
322
|
*
|
425
|
323
|
* @param eventType
|
|
@@ -556,7 +454,6 @@ export default class RTC extends Listenable {
|
556
|
454
|
getLocalVideoTrack() {
|
557
|
455
|
const localVideo = this.getLocalTracks(MediaType.VIDEO);
|
558
|
456
|
|
559
|
|
-
|
560
|
457
|
return localVideo.length ? localVideo[0] : undefined;
|
561
|
458
|
}
|
562
|
459
|
|
|
@@ -575,7 +472,6 @@ export default class RTC extends Listenable {
|
575
|
472
|
getLocalAudioTrack() {
|
576
|
473
|
const localAudio = this.getLocalTracks(MediaType.AUDIO);
|
577
|
474
|
|
578
|
|
-
|
579
|
475
|
return localAudio.length ? localAudio[0] : undefined;
|
580
|
476
|
}
|
581
|
477
|
|