mediasoup-client 3.6.43 → 3.6.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -129,6 +129,11 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
129
129
  audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
130
130
  video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
131
131
  };
132
+ if (dtlsParameters.role && dtlsParameters.role !== 'auto') {
133
+ this._forcedLocalDtlsRole = dtlsParameters.role === 'server'
134
+ ? 'client'
135
+ : 'server';
136
+ }
132
137
  this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'plan-b' }, additionalSettings), proprietaryConstraints);
133
138
  // Handle RTCPeerConnection connection status.
134
139
  this._pc.addEventListener('iceconnectionstatechange', () => {
@@ -185,6 +190,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
185
190
  return this._pc.getStats();
186
191
  }
187
192
  async send({ track, encodings, codecOptions, codec }) {
193
+ var _a;
188
194
  this._assertSendDirection();
189
195
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
190
196
  if (codec) {
@@ -201,8 +207,12 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
201
207
  const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
202
208
  sendingRemoteRtpParameters.codecs =
203
209
  ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
204
- if (!this._transportReady)
205
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
210
+ if (!this._transportReady) {
211
+ await this._setupTransport({
212
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'server',
213
+ localSdpObject
214
+ });
215
+ }
206
216
  if (track.kind === 'video' && encodings && encodings.length > 1) {
207
217
  logger.debug('send() | enabling simulcast');
208
218
  localSdpObject = sdpTransform.parse(offer.sdp);
@@ -307,6 +317,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
307
317
  throw new errors_1.UnsupportedError('not implemented');
308
318
  }
309
319
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
320
+ var _a;
310
321
  this._assertSendDirection();
311
322
  const options = {
312
323
  negotiated: true,
@@ -329,8 +340,12 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
329
340
  const localSdpObject = sdpTransform.parse(offer.sdp);
330
341
  const offerMediaObject = localSdpObject.media
331
342
  .find((m) => m.type === 'application');
332
- if (!this._transportReady)
333
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
343
+ if (!this._transportReady) {
344
+ await this._setupTransport({
345
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'server',
346
+ localSdpObject
347
+ });
348
+ }
334
349
  logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
335
350
  await this._pc.setLocalDescription(offer);
336
351
  this._remoteSdp.sendSctpAssociation({ offerMediaObject });
@@ -348,6 +363,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
348
363
  return { dataChannel, sctpStreamParameters };
349
364
  }
350
365
  async receive({ trackId, kind, rtpParameters }) {
366
+ var _a;
351
367
  this._assertRecvDirection();
352
368
  logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
353
369
  const localId = trackId;
@@ -380,8 +396,12 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
380
396
  answerMediaObject
381
397
  });
382
398
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
383
- if (!this._transportReady)
384
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
399
+ if (!this._transportReady) {
400
+ await this._setupTransport({
401
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
402
+ localSdpObject
403
+ });
404
+ }
385
405
  logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
386
406
  await this._pc.setLocalDescription(answer);
387
407
  const stream = this._pc.getRemoteStreams()
@@ -422,6 +442,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
422
442
  throw new errors_1.UnsupportedError('not implemented');
423
443
  }
424
444
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
445
+ var _a;
425
446
  this._assertRecvDirection();
426
447
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
427
448
  const options = {
@@ -445,7 +466,10 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
445
466
  const answer = await this._pc.createAnswer();
446
467
  if (!this._transportReady) {
447
468
  const localSdpObject = sdpTransform.parse(answer.sdp);
448
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
469
+ await this._setupTransport({
470
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
471
+ localSdpObject
472
+ });
449
473
  }
450
474
  logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
451
475
  await this._pc.setLocalDescription(answer);
@@ -7,6 +7,7 @@ export declare class Safari11 extends HandlerInterface {
7
7
  private _remoteSdp?;
8
8
  private _sendingRtpParametersByKind?;
9
9
  private _sendingRemoteRtpParametersByKind?;
10
+ private _forcedLocalDtlsRole?;
10
11
  private _pc;
11
12
  private readonly _sendStream;
12
13
  private readonly _mapSendLocalIdRtpSender;
@@ -1 +1 @@
1
- {"version":3,"file":"Safari11.d.ts","sourceRoot":"","sources":["../../src/handlers/Safari11.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAY,MA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AEnB,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1B,eAAe,CAEpB,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1B,kBAAkB,CACvB,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gCAAgC,GACzE,OAAO,CAAC,+BAA+B,CAAC;YAgE7B,eAAe;IA+B7B,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,oBAAoB;CAQ5B"}
@@ -124,6 +124,11 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
124
124
  audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
125
125
  video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
126
126
  };
127
+ if (dtlsParameters.role && dtlsParameters.role !== 'auto') {
128
+ this._forcedLocalDtlsRole = dtlsParameters.role === 'server'
129
+ ? 'client'
130
+ : 'server';
131
+ }
127
132
  this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require' }, additionalSettings), proprietaryConstraints);
128
133
  // Handle RTCPeerConnection connection status.
129
134
  this._pc.addEventListener('iceconnectionstatechange', () => {
@@ -180,6 +185,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
180
185
  return this._pc.getStats();
181
186
  }
182
187
  async send({ track, encodings, codecOptions, codec }) {
188
+ var _a;
183
189
  this._assertSendDirection();
184
190
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
185
191
  if (codec) {
@@ -196,8 +202,12 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
196
202
  const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
197
203
  sendingRemoteRtpParameters.codecs =
198
204
  ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
199
- if (!this._transportReady)
200
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
205
+ if (!this._transportReady) {
206
+ await this._setupTransport({
207
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'server',
208
+ localSdpObject
209
+ });
210
+ }
201
211
  if (track.kind === 'video' && encodings && encodings.length > 1) {
202
212
  logger.debug('send() | enabling simulcast');
203
213
  localSdpObject = sdpTransform.parse(offer.sdp);
@@ -339,6 +349,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
339
349
  return rtpSender.getStats();
340
350
  }
341
351
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
352
+ var _a;
342
353
  this._assertSendDirection();
343
354
  const options = {
344
355
  negotiated: true,
@@ -360,8 +371,12 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
360
371
  const localSdpObject = sdpTransform.parse(offer.sdp);
361
372
  const offerMediaObject = localSdpObject.media
362
373
  .find((m) => m.type === 'application');
363
- if (!this._transportReady)
364
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
374
+ if (!this._transportReady) {
375
+ await this._setupTransport({
376
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'server',
377
+ localSdpObject
378
+ });
379
+ }
365
380
  logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
366
381
  await this._pc.setLocalDescription(offer);
367
382
  this._remoteSdp.sendSctpAssociation({ offerMediaObject });
@@ -379,6 +394,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
379
394
  return { dataChannel, sctpStreamParameters };
380
395
  }
381
396
  async receive({ trackId, kind, rtpParameters }) {
397
+ var _a;
382
398
  this._assertRecvDirection();
383
399
  logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
384
400
  const localId = trackId;
@@ -404,8 +420,12 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
404
420
  answerMediaObject
405
421
  });
406
422
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
407
- if (!this._transportReady)
408
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
423
+ if (!this._transportReady) {
424
+ await this._setupTransport({
425
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
426
+ localSdpObject
427
+ });
428
+ }
409
429
  logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
410
430
  await this._pc.setLocalDescription(answer);
411
431
  const rtpReceiver = this._pc.getReceivers()
@@ -452,6 +472,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
452
472
  // Unimplemented.
453
473
  }
454
474
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
475
+ var _a;
455
476
  this._assertRecvDirection();
456
477
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
457
478
  const options = {
@@ -474,7 +495,10 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
474
495
  const answer = await this._pc.createAnswer();
475
496
  if (!this._transportReady) {
476
497
  const localSdpObject = sdpTransform.parse(answer.sdp);
477
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
498
+ await this._setupTransport({
499
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
500
+ localSdpObject
501
+ });
478
502
  }
479
503
  logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
480
504
  await this._pc.setLocalDescription(answer);
@@ -7,6 +7,7 @@ export declare class Safari12 extends HandlerInterface {
7
7
  private _remoteSdp?;
8
8
  private _sendingRtpParametersByKind?;
9
9
  private _sendingRemoteRtpParametersByKind?;
10
+ private _forcedLocalDtlsRole?;
10
11
  private _pc;
11
12
  private readonly _mapMidTransceiver;
12
13
  private readonly _sendStream;
@@ -1 +1 @@
1
- {"version":3,"file":"Safari12.d.ts","sourceRoot":"","sources":["../../src/handlers/Safari12.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB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OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B/C,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAY1D,kBAAkB,CACvB,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gCAAgC,GACzE,OAAO,CAAC,+BAA+B,CAAC;YAgE7B,eAAe;IA+B7B,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,oBAAoB;CAQ5B"}
@@ -116,6 +116,11 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
116
116
  audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
117
117
  video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
118
118
  };
119
+ if (dtlsParameters.role && dtlsParameters.role !== 'auto') {
120
+ this._forcedLocalDtlsRole = dtlsParameters.role === 'server'
121
+ ? 'client'
122
+ : 'server';
123
+ }
119
124
  this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require' }, additionalSettings), proprietaryConstraints);
120
125
  // Handle RTCPeerConnection connection status.
121
126
  this._pc.addEventListener('iceconnectionstatechange', () => {
@@ -172,6 +177,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
172
177
  return this._pc.getStats();
173
178
  }
174
179
  async send({ track, encodings, codecOptions, codec }) {
180
+ var _a;
175
181
  this._assertSendDirection();
176
182
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
177
183
  const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
@@ -187,8 +193,12 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
187
193
  let offer = await this._pc.createOffer();
188
194
  let localSdpObject = sdpTransform.parse(offer.sdp);
189
195
  let offerMediaObject;
190
- if (!this._transportReady)
191
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
196
+ if (!this._transportReady) {
197
+ await this._setupTransport({
198
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'server',
199
+ localSdpObject
200
+ });
201
+ }
192
202
  if (encodings && encodings.length > 1) {
193
203
  logger.debug('send() | enabling legacy simulcast');
194
204
  localSdpObject = sdpTransform.parse(offer.sdp);
@@ -312,6 +322,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
312
322
  return transceiver.sender.getStats();
313
323
  }
314
324
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
325
+ var _a;
315
326
  this._assertSendDirection();
316
327
  const options = {
317
328
  negotiated: true,
@@ -333,8 +344,12 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
333
344
  const localSdpObject = sdpTransform.parse(offer.sdp);
334
345
  const offerMediaObject = localSdpObject.media
335
346
  .find((m) => m.type === 'application');
336
- if (!this._transportReady)
337
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
347
+ if (!this._transportReady) {
348
+ await this._setupTransport({
349
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'server',
350
+ localSdpObject
351
+ });
352
+ }
338
353
  logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
339
354
  await this._pc.setLocalDescription(offer);
340
355
  this._remoteSdp.sendSctpAssociation({ offerMediaObject });
@@ -352,6 +367,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
352
367
  return { dataChannel, sctpStreamParameters };
353
368
  }
354
369
  async receive({ trackId, kind, rtpParameters }) {
370
+ var _a;
355
371
  this._assertRecvDirection();
356
372
  logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
357
373
  const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
@@ -376,8 +392,12 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
376
392
  answerMediaObject
377
393
  });
378
394
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
379
- if (!this._transportReady)
380
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
395
+ if (!this._transportReady) {
396
+ await this._setupTransport({
397
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
398
+ localSdpObject
399
+ });
400
+ }
381
401
  logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
382
402
  await this._pc.setLocalDescription(answer);
383
403
  const transceiver = this._pc.getTransceivers()
@@ -443,6 +463,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
443
463
  return transceiver.receiver.getStats();
444
464
  }
445
465
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
466
+ var _a;
446
467
  this._assertRecvDirection();
447
468
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
448
469
  const options = {
@@ -465,7 +486,10 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
465
486
  const answer = await this._pc.createAnswer();
466
487
  if (!this._transportReady) {
467
488
  const localSdpObject = sdpTransform.parse(answer.sdp);
468
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
489
+ await this._setupTransport({
490
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
491
+ localSdpObject
492
+ });
469
493
  }
470
494
  logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
471
495
  await this._pc.setLocalDescription(answer);
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { types };
8
8
  /**
9
9
  * Expose mediasoup-client version.
10
10
  */
11
- export declare const version = "3.6.43";
11
+ export declare const version = "3.6.44";
12
12
  /**
13
13
  * Expose Device class and detectDevice() helper.
14
14
  */
package/lib/index.js CHANGED
@@ -33,7 +33,7 @@ exports.types = types;
33
33
  /**
34
34
  * Expose mediasoup-client version.
35
35
  */
36
- exports.version = '3.6.43';
36
+ exports.version = '3.6.44';
37
37
  /**
38
38
  * Expose parseScalabilityMode() function.
39
39
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup-client",
3
- "version": "3.6.43",
3
+ "version": "3.6.44",
4
4
  "description": "mediasoup client side JavaScript library",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -53,7 +53,7 @@
53
53
  "@typescript-eslint/parser": "^4.33.0",
54
54
  "eslint": "^7.32.0",
55
55
  "eslint-plugin-jest": "^24.5.2",
56
- "jest": "^27.2.4",
56
+ "jest": "^27.3.1",
57
57
  "jest-tobetype": "^1.2.3",
58
58
  "open-cli": "^6.0.1",
59
59
  "tsc-watch": "^4.5.0",
package/src/Transport.ts CHANGED
@@ -80,7 +80,7 @@ export type IceCandidate =
80
80
  */
81
81
  port: number;
82
82
  /**
83
- * The type of candidate..
83
+ * The type of candidate.
84
84
  */
85
85
  type: 'host' | 'srflx' | 'prflx' | 'relay';
86
86
  /**
@@ -92,11 +92,11 @@ export type IceCandidate =
92
92
  export type DtlsParameters =
93
93
  {
94
94
  /**
95
- * DTLS role. Default 'auto'.
95
+ * Server DTLS role. Default 'auto'.
96
96
  */
97
97
  role?: DtlsRole;
98
98
  /**
99
- * DTLS fingerprints.
99
+ * Server DTLS fingerprints.
100
100
  */
101
101
  fingerprints: DtlsFingerprint[];
102
102
  }
@@ -38,6 +38,9 @@ export class Chrome55 extends HandlerInterface
38
38
  // Generic sending RTP parameters for audio and video suitable for the SDP
39
39
  // remote answer.
40
40
  private _sendingRemoteRtpParametersByKind?: { [key: string]: RtpParameters };
41
+ // Initial server side DTLS role. If not 'auto', it will force the opposite
42
+ // value in client side.
43
+ private _forcedLocalDtlsRole?: DtlsRole;
41
44
  // RTCPeerConnection instance.
42
45
  private _pc: any;
43
46
  // Local stream for sending.
@@ -181,6 +184,13 @@ export class Chrome55 extends HandlerInterface
181
184
  video : ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
182
185
  };
183
186
 
187
+ if (dtlsParameters.role && dtlsParameters.role !== 'auto')
188
+ {
189
+ this._forcedLocalDtlsRole = dtlsParameters.role === 'server'
190
+ ? 'client'
191
+ : 'server';
192
+ }
193
+
184
194
  this._pc = new (RTCPeerConnection as any)(
185
195
  {
186
196
  iceServers : iceServers || [],
@@ -315,7 +325,13 @@ export class Chrome55 extends HandlerInterface
315
325
  ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
316
326
 
317
327
  if (!this._transportReady)
318
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
328
+ {
329
+ await this._setupTransport(
330
+ {
331
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'server',
332
+ localSdpObject
333
+ });
334
+ }
319
335
 
320
336
  if (track.kind === 'video' && encodings && encodings.length > 1)
321
337
  {
@@ -525,7 +541,13 @@ export class Chrome55 extends HandlerInterface
525
541
  .find((m: any) => m.type === 'application');
526
542
 
527
543
  if (!this._transportReady)
528
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
544
+ {
545
+ await this._setupTransport(
546
+ {
547
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'server',
548
+ localSdpObject
549
+ });
550
+ }
529
551
 
530
552
  logger.debug(
531
553
  'sendDataChannel() | calling pc.setLocalDescription() [offer:%o]',
@@ -602,7 +624,13 @@ export class Chrome55 extends HandlerInterface
602
624
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
603
625
 
604
626
  if (!this._transportReady)
605
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
627
+ {
628
+ await this._setupTransport(
629
+ {
630
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
631
+ localSdpObject
632
+ });
633
+ }
606
634
 
607
635
  logger.debug(
608
636
  'receive() | calling pc.setLocalDescription() [answer:%o]',
@@ -722,7 +750,11 @@ export class Chrome55 extends HandlerInterface
722
750
  {
723
751
  const localSdpObject = sdpTransform.parse(answer.sdp);
724
752
 
725
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
753
+ await this._setupTransport(
754
+ {
755
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
756
+ localSdpObject
757
+ });
726
758
  }
727
759
 
728
760
  logger.debug(
@@ -37,6 +37,9 @@ export class Chrome67 extends HandlerInterface
37
37
  // Generic sending RTP parameters for audio and video suitable for the SDP
38
38
  // remote answer.
39
39
  private _sendingRemoteRtpParametersByKind?: { [key: string]: RtpParameters };
40
+ // Initial server side DTLS role. If not 'auto', it will force the opposite
41
+ // value in client side.
42
+ private _forcedLocalDtlsRole?: DtlsRole;
40
43
  // RTCPeerConnection instance.
41
44
  private _pc: any;
42
45
  // Local stream for sending.
@@ -182,6 +185,13 @@ export class Chrome67 extends HandlerInterface
182
185
  video : ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
183
186
  };
184
187
 
188
+ if (dtlsParameters.role && dtlsParameters.role !== 'auto')
189
+ {
190
+ this._forcedLocalDtlsRole = dtlsParameters.role === 'server'
191
+ ? 'client'
192
+ : 'server';
193
+ }
194
+
185
195
  this._pc = new (RTCPeerConnection as any)(
186
196
  {
187
197
  iceServers : iceServers || [],
@@ -316,7 +326,13 @@ export class Chrome67 extends HandlerInterface
316
326
  ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
317
327
 
318
328
  if (!this._transportReady)
319
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
329
+ {
330
+ await this._setupTransport(
331
+ {
332
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'server',
333
+ localSdpObject
334
+ });
335
+ }
320
336
 
321
337
  if (track.kind === 'video' && encodings && encodings.length > 1)
322
338
  {
@@ -602,7 +618,13 @@ export class Chrome67 extends HandlerInterface
602
618
  .find((m: any) => m.type === 'application');
603
619
 
604
620
  if (!this._transportReady)
605
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
621
+ {
622
+ await this._setupTransport(
623
+ {
624
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'server',
625
+ localSdpObject
626
+ });
627
+ }
606
628
 
607
629
  logger.debug(
608
630
  'sendDataChannel() | calling pc.setLocalDescription() [offer:%o]',
@@ -678,7 +700,13 @@ export class Chrome67 extends HandlerInterface
678
700
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
679
701
 
680
702
  if (!this._transportReady)
681
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
703
+ {
704
+ await this._setupTransport(
705
+ {
706
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
707
+ localSdpObject
708
+ });
709
+ }
682
710
 
683
711
  logger.debug(
684
712
  'receive() | calling pc.setLocalDescription() [answer:%o]',
@@ -807,7 +835,11 @@ export class Chrome67 extends HandlerInterface
807
835
  {
808
836
  const localSdpObject = sdpTransform.parse(answer.sdp);
809
837
 
810
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
838
+ await this._setupTransport(
839
+ {
840
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
841
+ localSdpObject
842
+ });
811
843
  }
812
844
 
813
845
  logger.debug(
@@ -38,6 +38,9 @@ export class Chrome70 extends HandlerInterface
38
38
  // Generic sending RTP parameters for audio and video suitable for the SDP
39
39
  // remote answer.
40
40
  private _sendingRemoteRtpParametersByKind?: { [key: string]: RtpParameters };
41
+ // Initial server side DTLS role. If not 'auto', it will force the opposite
42
+ // value in client side.
43
+ private _forcedLocalDtlsRole?: DtlsRole;
41
44
  // RTCPeerConnection instance.
42
45
  private _pc: any;
43
46
  // Map of RTCTransceivers indexed by MID.
@@ -168,6 +171,13 @@ export class Chrome70 extends HandlerInterface
168
171
  video : ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
169
172
  };
170
173
 
174
+ if (dtlsParameters.role && dtlsParameters.role !== 'auto')
175
+ {
176
+ this._forcedLocalDtlsRole = dtlsParameters.role === 'server'
177
+ ? 'client'
178
+ : 'server';
179
+ }
180
+
171
181
  this._pc = new (RTCPeerConnection as any)(
172
182
  {
173
183
  iceServers : iceServers || [],
@@ -298,7 +308,13 @@ export class Chrome70 extends HandlerInterface
298
308
  let offerMediaObject;
299
309
 
300
310
  if (!this._transportReady)
301
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
311
+ {
312
+ await this._setupTransport(
313
+ {
314
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'server',
315
+ localSdpObject
316
+ });
317
+ }
302
318
 
303
319
  if (encodings && encodings.length > 1)
304
320
  {
@@ -608,7 +624,13 @@ export class Chrome70 extends HandlerInterface
608
624
  .find((m: any) => m.type === 'application');
609
625
 
610
626
  if (!this._transportReady)
611
- await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
627
+ {
628
+ await this._setupTransport(
629
+ {
630
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'server',
631
+ localSdpObject
632
+ });
633
+ }
612
634
 
613
635
  logger.debug(
614
636
  'sendDataChannel() | calling pc.setLocalDescription() [offer:%o]',
@@ -683,7 +705,13 @@ export class Chrome70 extends HandlerInterface
683
705
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
684
706
 
685
707
  if (!this._transportReady)
686
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
708
+ {
709
+ await this._setupTransport(
710
+ {
711
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
712
+ localSdpObject
713
+ });
714
+ }
687
715
 
688
716
  logger.debug(
689
717
  'receive() | calling pc.setLocalDescription() [answer:%o]',
@@ -813,7 +841,11 @@ export class Chrome70 extends HandlerInterface
813
841
  {
814
842
  const localSdpObject = sdpTransform.parse(answer.sdp);
815
843
 
816
- await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
844
+ await this._setupTransport(
845
+ {
846
+ localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
847
+ localSdpObject
848
+ });
817
849
  }
818
850
 
819
851
  logger.debug(