mediasoup-client 3.6.42 → 3.6.46
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.
- package/lib/DataConsumer.d.ts +2 -2
- package/lib/DataConsumer.d.ts.map +1 -1
- package/lib/Device.d.ts.map +1 -1
- package/lib/Device.js +7 -3
- package/lib/Logger.js +6 -6
- package/lib/Transport.d.ts +3 -3
- package/lib/Transport.js +1 -1
- package/lib/handlers/Chrome55.d.ts +1 -0
- package/lib/handlers/Chrome55.d.ts.map +1 -1
- package/lib/handlers/Chrome55.js +40 -9
- package/lib/handlers/Chrome67.d.ts +1 -0
- package/lib/handlers/Chrome67.d.ts.map +1 -1
- package/lib/handlers/Chrome67.js +41 -10
- package/lib/handlers/Chrome70.d.ts +1 -0
- package/lib/handlers/Chrome70.d.ts.map +1 -1
- package/lib/handlers/Chrome70.js +44 -11
- package/lib/handlers/Chrome74.d.ts +1 -0
- package/lib/handlers/Chrome74.d.ts.map +1 -1
- package/lib/handlers/Chrome74.js +44 -11
- package/lib/handlers/Edge11.d.ts.map +1 -1
- package/lib/handlers/Edge11.js +3 -2
- package/lib/handlers/FakeHandler.js +1 -1
- package/lib/handlers/Firefox60.d.ts.map +1 -1
- package/lib/handlers/Firefox60.js +12 -4
- package/lib/handlers/ReactNative.d.ts +1 -0
- package/lib/handlers/ReactNative.d.ts.map +1 -1
- package/lib/handlers/ReactNative.js +40 -9
- package/lib/handlers/Safari11.d.ts +1 -0
- package/lib/handlers/Safari11.d.ts.map +1 -1
- package/lib/handlers/Safari11.js +40 -10
- package/lib/handlers/Safari12.d.ts +1 -0
- package/lib/handlers/Safari12.d.ts.map +1 -1
- package/lib/handlers/Safari12.js +42 -10
- package/lib/handlers/ortc/edgeUtils.js +1 -1
- package/lib/handlers/sdp/MediaSection.js +1 -1
- package/lib/handlers/sdp/RemoteSdp.js +1 -1
- package/lib/handlers/sdp/commonUtils.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -3
- package/lib/ortc.js +1 -1
- package/lib/types.js +1 -1
- package/package.json +9 -9
- package/src/DataConsumer.ts +2 -2
- package/src/Device.ts +7 -2
- package/src/Transport.ts +3 -3
- package/src/handlers/Chrome55.ts +37 -5
- package/src/handlers/Chrome67.ts +37 -5
- package/src/handlers/Chrome70.ts +40 -4
- package/src/handlers/Chrome74.ts +40 -4
- package/src/handlers/Edge11.ts +3 -1
- package/src/handlers/Firefox60.ts +5 -1
- package/src/handlers/ReactNative.ts +37 -5
- package/src/handlers/Safari11.ts +37 -5
- package/src/handlers/Safari12.ts +40 -4
- package/tsconfig.json +1 -1
package/lib/handlers/Safari12.js
CHANGED
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -116,7 +116,18 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
116
116
|
audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
|
|
117
117
|
video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
|
|
118
118
|
};
|
|
119
|
-
|
|
119
|
+
if (dtlsParameters.role && dtlsParameters.role !== 'auto') {
|
|
120
|
+
this._forcedLocalDtlsRole = dtlsParameters.role === 'server'
|
|
121
|
+
? 'client'
|
|
122
|
+
: 'server';
|
|
123
|
+
}
|
|
124
|
+
this._pc = new RTCPeerConnection({
|
|
125
|
+
iceServers: iceServers || [],
|
|
126
|
+
iceTransportPolicy: iceTransportPolicy || 'all',
|
|
127
|
+
bundlePolicy: 'max-bundle',
|
|
128
|
+
rtcpMuxPolicy: 'require',
|
|
129
|
+
...additionalSettings
|
|
130
|
+
}, proprietaryConstraints);
|
|
120
131
|
// Handle RTCPeerConnection connection status.
|
|
121
132
|
this._pc.addEventListener('iceconnectionstatechange', () => {
|
|
122
133
|
switch (this._pc.iceConnectionState) {
|
|
@@ -172,6 +183,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
172
183
|
return this._pc.getStats();
|
|
173
184
|
}
|
|
174
185
|
async send({ track, encodings, codecOptions, codec }) {
|
|
186
|
+
var _a;
|
|
175
187
|
this._assertSendDirection();
|
|
176
188
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
177
189
|
const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
|
|
@@ -187,8 +199,12 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
187
199
|
let offer = await this._pc.createOffer();
|
|
188
200
|
let localSdpObject = sdpTransform.parse(offer.sdp);
|
|
189
201
|
let offerMediaObject;
|
|
190
|
-
if (!this._transportReady)
|
|
191
|
-
await this._setupTransport({
|
|
202
|
+
if (!this._transportReady) {
|
|
203
|
+
await this._setupTransport({
|
|
204
|
+
localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
|
|
205
|
+
localSdpObject
|
|
206
|
+
});
|
|
207
|
+
}
|
|
192
208
|
if (encodings && encodings.length > 1) {
|
|
193
209
|
logger.debug('send() | enabling legacy simulcast');
|
|
194
210
|
localSdpObject = sdpTransform.parse(offer.sdp);
|
|
@@ -262,6 +278,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
262
278
|
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
|
|
263
279
|
logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
|
|
264
280
|
await this._pc.setRemoteDescription(answer);
|
|
281
|
+
this._mapMidTransceiver.delete(localId);
|
|
265
282
|
}
|
|
266
283
|
async replaceTrack(localId, track) {
|
|
267
284
|
this._assertSendDirection();
|
|
@@ -299,7 +316,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
299
316
|
throw new Error('associated RTCRtpTransceiver not found');
|
|
300
317
|
const parameters = transceiver.sender.getParameters();
|
|
301
318
|
parameters.encodings.forEach((encoding, idx) => {
|
|
302
|
-
parameters.encodings[idx] =
|
|
319
|
+
parameters.encodings[idx] = { ...encoding, ...params };
|
|
303
320
|
});
|
|
304
321
|
await transceiver.sender.setParameters(parameters);
|
|
305
322
|
}
|
|
@@ -311,6 +328,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
311
328
|
return transceiver.sender.getStats();
|
|
312
329
|
}
|
|
313
330
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
331
|
+
var _a;
|
|
314
332
|
this._assertSendDirection();
|
|
315
333
|
const options = {
|
|
316
334
|
negotiated: true,
|
|
@@ -332,8 +350,12 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
332
350
|
const localSdpObject = sdpTransform.parse(offer.sdp);
|
|
333
351
|
const offerMediaObject = localSdpObject.media
|
|
334
352
|
.find((m) => m.type === 'application');
|
|
335
|
-
if (!this._transportReady)
|
|
336
|
-
await this._setupTransport({
|
|
353
|
+
if (!this._transportReady) {
|
|
354
|
+
await this._setupTransport({
|
|
355
|
+
localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
|
|
356
|
+
localSdpObject
|
|
357
|
+
});
|
|
358
|
+
}
|
|
337
359
|
logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
|
|
338
360
|
await this._pc.setLocalDescription(offer);
|
|
339
361
|
this._remoteSdp.sendSctpAssociation({ offerMediaObject });
|
|
@@ -351,6 +373,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
351
373
|
return { dataChannel, sctpStreamParameters };
|
|
352
374
|
}
|
|
353
375
|
async receive({ trackId, kind, rtpParameters }) {
|
|
376
|
+
var _a;
|
|
354
377
|
this._assertRecvDirection();
|
|
355
378
|
logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
|
|
356
379
|
const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
|
|
@@ -375,8 +398,12 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
375
398
|
answerMediaObject
|
|
376
399
|
});
|
|
377
400
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
378
|
-
if (!this._transportReady)
|
|
379
|
-
await this._setupTransport({
|
|
401
|
+
if (!this._transportReady) {
|
|
402
|
+
await this._setupTransport({
|
|
403
|
+
localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
|
|
404
|
+
localSdpObject
|
|
405
|
+
});
|
|
406
|
+
}
|
|
380
407
|
logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
|
|
381
408
|
await this._pc.setLocalDescription(answer);
|
|
382
409
|
const transceiver = this._pc.getTransceivers()
|
|
@@ -404,6 +431,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
404
431
|
const answer = await this._pc.createAnswer();
|
|
405
432
|
logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
|
|
406
433
|
await this._pc.setLocalDescription(answer);
|
|
434
|
+
this._mapMidTransceiver.delete(localId);
|
|
407
435
|
}
|
|
408
436
|
async pauseReceiving(localId) {
|
|
409
437
|
this._assertRecvDirection();
|
|
@@ -441,6 +469,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
441
469
|
return transceiver.receiver.getStats();
|
|
442
470
|
}
|
|
443
471
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
472
|
+
var _a;
|
|
444
473
|
this._assertRecvDirection();
|
|
445
474
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
446
475
|
const options = {
|
|
@@ -463,7 +492,10 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
463
492
|
const answer = await this._pc.createAnswer();
|
|
464
493
|
if (!this._transportReady) {
|
|
465
494
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
466
|
-
await this._setupTransport({
|
|
495
|
+
await this._setupTransport({
|
|
496
|
+
localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
|
|
497
|
+
localSdpObject
|
|
498
|
+
});
|
|
467
499
|
}
|
|
468
500
|
logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
|
|
469
501
|
await this._pc.setLocalDescription(answer);
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.debug = exports.detectDevice = exports.Device = exports.version = exports.types = void 0;
|
|
25
|
+
exports.debug = exports.parseScalabilityMode = exports.detectDevice = exports.Device = exports.version = exports.types = void 0;
|
|
26
26
|
const debug_1 = __importDefault(require("debug"));
|
|
27
27
|
exports.debug = debug_1.default;
|
|
28
28
|
const Device_1 = require("./Device");
|
|
@@ -33,7 +33,7 @@ exports.types = types;
|
|
|
33
33
|
/**
|
|
34
34
|
* Expose mediasoup-client version.
|
|
35
35
|
*/
|
|
36
|
-
exports.version = '3.6.
|
|
36
|
+
exports.version = '3.6.46';
|
|
37
37
|
/**
|
|
38
38
|
* Expose parseScalabilityMode() function.
|
|
39
39
|
*/
|
package/lib/ortc.js
CHANGED
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
package/lib/types.js
CHANGED
|
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./Device"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediasoup-client",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.46",
|
|
4
4
|
"description": "mediasoup client side JavaScript library",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
"fake-mediastreamtrack": "^1.1.6",
|
|
45
45
|
"h264-profile-level-id": "^1.0.1",
|
|
46
46
|
"sdp-transform": "^2.14.1",
|
|
47
|
-
"supports-color": "^
|
|
47
|
+
"supports-color": "^9.1.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/sdp-transform": "^2.4.5",
|
|
51
51
|
"@types/uuid": "^3.4.9",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
53
|
-
"@typescript-eslint/parser": "^4.
|
|
54
|
-
"eslint": "^
|
|
55
|
-
"eslint-plugin-jest": "^
|
|
56
|
-
"jest": "^27.
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
53
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
54
|
+
"eslint": "^8.3.0",
|
|
55
|
+
"eslint-plugin-jest": "^25.3.0",
|
|
56
|
+
"jest": "^27.3.1",
|
|
57
57
|
"jest-tobetype": "^1.2.3",
|
|
58
|
-
"open-cli": "^
|
|
58
|
+
"open-cli": "^7.0.1",
|
|
59
59
|
"tsc-watch": "^4.5.0",
|
|
60
|
-
"typescript": "^
|
|
60
|
+
"typescript": "^4.5.2",
|
|
61
61
|
"uuid": "^3.4.0"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/DataConsumer.ts
CHANGED
|
@@ -128,7 +128,7 @@ export class DataConsumer extends EnhancedEventEmitter
|
|
|
128
128
|
/**
|
|
129
129
|
* DataChannel binaryType.
|
|
130
130
|
*/
|
|
131
|
-
get binaryType():
|
|
131
|
+
get binaryType(): BinaryType
|
|
132
132
|
{
|
|
133
133
|
return this._dataChannel.binaryType;
|
|
134
134
|
}
|
|
@@ -136,7 +136,7 @@ export class DataConsumer extends EnhancedEventEmitter
|
|
|
136
136
|
/**
|
|
137
137
|
* Set DataChannel binaryType.
|
|
138
138
|
*/
|
|
139
|
-
set binaryType(binaryType:
|
|
139
|
+
set binaryType(binaryType: BinaryType)
|
|
140
140
|
{
|
|
141
141
|
this._dataChannel.binaryType = binaryType;
|
|
142
142
|
}
|
package/src/Device.ts
CHANGED
|
@@ -80,8 +80,8 @@ export function detectDevice(): BuiltinHandlerName | undefined
|
|
|
80
80
|
const browser = Bowser.getParser(ua);
|
|
81
81
|
const engine = browser.getEngine();
|
|
82
82
|
|
|
83
|
-
// Chrome and
|
|
84
|
-
if (browser.satisfies({ chrome: '>=74', chromium: '>=74' }))
|
|
83
|
+
// Chrome, Chromium, and Edge.
|
|
84
|
+
if (browser.satisfies({ chrome: '>=74', chromium: '>=74', 'microsoft edge': '>=88' }))
|
|
85
85
|
{
|
|
86
86
|
return 'Chrome74';
|
|
87
87
|
}
|
|
@@ -102,6 +102,11 @@ export function detectDevice(): BuiltinHandlerName | undefined
|
|
|
102
102
|
{
|
|
103
103
|
return 'Firefox60';
|
|
104
104
|
}
|
|
105
|
+
// Firefox on iOS.
|
|
106
|
+
else if (browser.satisfies({ ios: { OS: '>=14.3', firefox: '>=30.0' } }))
|
|
107
|
+
{
|
|
108
|
+
return 'Safari12';
|
|
109
|
+
}
|
|
105
110
|
// Safari with Unified-Plan support enabled.
|
|
106
111
|
else if (
|
|
107
112
|
browser.satisfies({ safari: '>=12.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
|
}
|
package/src/handlers/Chrome55.ts
CHANGED
|
@@ -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
|
-
|
|
328
|
+
{
|
|
329
|
+
await this._setupTransport(
|
|
330
|
+
{
|
|
331
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
332
|
+
localSdpObject
|
|
333
|
+
});
|
|
334
|
+
}
|
|
319
335
|
|
|
320
336
|
if (track.kind === 'video' && encodings && encodings.length > 1)
|
|
321
337
|
{
|
|
@@ -438,7 +454,7 @@ export class Chrome55 extends HandlerInterface
|
|
|
438
454
|
{
|
|
439
455
|
logger.warn(
|
|
440
456
|
'stopSending() | ignoring expected error due no sending tracks: %s',
|
|
441
|
-
error.toString());
|
|
457
|
+
(error as Error).toString());
|
|
442
458
|
|
|
443
459
|
return;
|
|
444
460
|
}
|
|
@@ -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
|
-
|
|
544
|
+
{
|
|
545
|
+
await this._setupTransport(
|
|
546
|
+
{
|
|
547
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
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
|
-
|
|
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(
|
|
753
|
+
await this._setupTransport(
|
|
754
|
+
{
|
|
755
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
756
|
+
localSdpObject
|
|
757
|
+
});
|
|
726
758
|
}
|
|
727
759
|
|
|
728
760
|
logger.debug(
|
package/src/handlers/Chrome67.ts
CHANGED
|
@@ -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
|
-
|
|
329
|
+
{
|
|
330
|
+
await this._setupTransport(
|
|
331
|
+
{
|
|
332
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
333
|
+
localSdpObject
|
|
334
|
+
});
|
|
335
|
+
}
|
|
320
336
|
|
|
321
337
|
if (track.kind === 'video' && encodings && encodings.length > 1)
|
|
322
338
|
{
|
|
@@ -446,7 +462,7 @@ export class Chrome67 extends HandlerInterface
|
|
|
446
462
|
{
|
|
447
463
|
logger.warn(
|
|
448
464
|
'stopSending() | ignoring expected error due no sending tracks: %s',
|
|
449
|
-
error.toString());
|
|
465
|
+
(error as Error).toString());
|
|
450
466
|
|
|
451
467
|
return;
|
|
452
468
|
}
|
|
@@ -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
|
-
|
|
621
|
+
{
|
|
622
|
+
await this._setupTransport(
|
|
623
|
+
{
|
|
624
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
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
|
-
|
|
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(
|
|
838
|
+
await this._setupTransport(
|
|
839
|
+
{
|
|
840
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
841
|
+
localSdpObject
|
|
842
|
+
});
|
|
811
843
|
}
|
|
812
844
|
|
|
813
845
|
logger.debug(
|
package/src/handlers/Chrome70.ts
CHANGED
|
@@ -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
|
-
|
|
311
|
+
{
|
|
312
|
+
await this._setupTransport(
|
|
313
|
+
{
|
|
314
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
315
|
+
localSdpObject
|
|
316
|
+
});
|
|
317
|
+
}
|
|
302
318
|
|
|
303
319
|
if (encodings && encodings.length > 1)
|
|
304
320
|
{
|
|
@@ -478,6 +494,8 @@ export class Chrome70 extends HandlerInterface
|
|
|
478
494
|
answer);
|
|
479
495
|
|
|
480
496
|
await this._pc.setRemoteDescription(answer);
|
|
497
|
+
|
|
498
|
+
this._mapMidTransceiver.delete(localId);
|
|
481
499
|
}
|
|
482
500
|
|
|
483
501
|
async replaceTrack(
|
|
@@ -606,7 +624,13 @@ export class Chrome70 extends HandlerInterface
|
|
|
606
624
|
.find((m: any) => m.type === 'application');
|
|
607
625
|
|
|
608
626
|
if (!this._transportReady)
|
|
609
|
-
|
|
627
|
+
{
|
|
628
|
+
await this._setupTransport(
|
|
629
|
+
{
|
|
630
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
631
|
+
localSdpObject
|
|
632
|
+
});
|
|
633
|
+
}
|
|
610
634
|
|
|
611
635
|
logger.debug(
|
|
612
636
|
'sendDataChannel() | calling pc.setLocalDescription() [offer:%o]',
|
|
@@ -681,7 +705,13 @@ export class Chrome70 extends HandlerInterface
|
|
|
681
705
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
682
706
|
|
|
683
707
|
if (!this._transportReady)
|
|
684
|
-
|
|
708
|
+
{
|
|
709
|
+
await this._setupTransport(
|
|
710
|
+
{
|
|
711
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
712
|
+
localSdpObject
|
|
713
|
+
});
|
|
714
|
+
}
|
|
685
715
|
|
|
686
716
|
logger.debug(
|
|
687
717
|
'receive() | calling pc.setLocalDescription() [answer:%o]',
|
|
@@ -733,6 +763,8 @@ export class Chrome70 extends HandlerInterface
|
|
|
733
763
|
answer);
|
|
734
764
|
|
|
735
765
|
await this._pc.setLocalDescription(answer);
|
|
766
|
+
|
|
767
|
+
this._mapMidTransceiver.delete(localId);
|
|
736
768
|
}
|
|
737
769
|
|
|
738
770
|
async pauseReceiving(
|
|
@@ -809,7 +841,11 @@ export class Chrome70 extends HandlerInterface
|
|
|
809
841
|
{
|
|
810
842
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
811
843
|
|
|
812
|
-
await this._setupTransport(
|
|
844
|
+
await this._setupTransport(
|
|
845
|
+
{
|
|
846
|
+
localDtlsRole : this._forcedLocalDtlsRole ?? 'client',
|
|
847
|
+
localSdpObject
|
|
848
|
+
});
|
|
813
849
|
}
|
|
814
850
|
|
|
815
851
|
logger.debug(
|