vani-meeting-client 1.1.6 → 1.1.8
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.
|
@@ -15,6 +15,7 @@ export declare class SFUHandler extends BaseVideoCallHandler {
|
|
|
15
15
|
private dataProducers;
|
|
16
16
|
private dataConsumer;
|
|
17
17
|
constructor(_meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler);
|
|
18
|
+
reconnectedWithoutPing(): void;
|
|
18
19
|
onReconnect(): Promise<void>;
|
|
19
20
|
private onRestartIceCandidateResponse;
|
|
20
21
|
stopTrack(track: Track): void;
|
|
@@ -90,6 +90,9 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
90
90
|
}
|
|
91
91
|
return _this;
|
|
92
92
|
}
|
|
93
|
+
SFUHandler.prototype.reconnectedWithoutPing = function () {
|
|
94
|
+
this.onReconnect();
|
|
95
|
+
};
|
|
93
96
|
SFUHandler.prototype.onReconnect = function () {
|
|
94
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
95
98
|
var data, data;
|
|
@@ -110,22 +113,46 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
110
113
|
});
|
|
111
114
|
};
|
|
112
115
|
SFUHandler.prototype.onRestartIceCandidateResponse = function (data) {
|
|
113
|
-
var _a;
|
|
116
|
+
var _a, _b, _c, _d;
|
|
114
117
|
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
-
var transportId, iceParameters, messageJson;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
var transportId, iceParameters, _i, _e, consumer, messageJson;
|
|
119
|
+
var _this = this;
|
|
120
|
+
return __generator(this, function (_f) {
|
|
121
|
+
switch (_f.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
transportId = data.message.transportId;
|
|
124
|
+
iceParameters = data.message.iceParameters;
|
|
125
|
+
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.downloadParticipantsData();
|
|
126
|
+
if (!(this.consumerTransport && this.consumerTransport.id === transportId)) return [3 /*break*/, 2];
|
|
127
|
+
console.log("restartIce", "communicationHandler");
|
|
128
|
+
return [4 /*yield*/, this.consumerTransport.restartIce({ iceParameters: iceParameters })];
|
|
129
|
+
case 1:
|
|
130
|
+
_f.sent();
|
|
131
|
+
for (_i = 0, _e = this.consumers; _i < _e.length; _i++) {
|
|
132
|
+
consumer = _e[_i];
|
|
133
|
+
if (consumer) {
|
|
134
|
+
consumer.close();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
this.consumers = [];
|
|
138
|
+
messageJson = { to: "self", type: SFUMessageType.GetAllProducers, message: {} };
|
|
139
|
+
this.sendSFUMessageToSocket(messageJson);
|
|
140
|
+
return [3 /*break*/, 4];
|
|
141
|
+
case 2:
|
|
142
|
+
if (!(this.sendTransport && this.sendTransport.id === transportId)) return [3 /*break*/, 4];
|
|
143
|
+
return [4 /*yield*/, this.sendTransport.restartIce({ iceParameters: iceParameters })];
|
|
144
|
+
case 3:
|
|
145
|
+
_f.sent();
|
|
146
|
+
console.log("restartIce", "sendTransport", (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.getAllSelfTracks().length);
|
|
147
|
+
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.getAllSelfTracks().forEach(function (eachSelfTrack) {
|
|
148
|
+
_this.stopTrack(eachSelfTrack);
|
|
149
|
+
});
|
|
150
|
+
(_d = this.communicationHandler) === null || _d === void 0 ? void 0 : _d.getAllSelfTracks().forEach(function (eachSelfTrack) {
|
|
151
|
+
_this.sendTrack(eachSelfTrack);
|
|
152
|
+
});
|
|
153
|
+
_f.label = 4;
|
|
154
|
+
case 4: return [2 /*return*/];
|
|
124
155
|
}
|
|
125
|
-
messageJson = { to: "self", type: SFUMessageType.GetAllProducers, message: {} };
|
|
126
|
-
this.sendSFUMessageToSocket(messageJson);
|
|
127
|
-
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.downloadParticipantsData();
|
|
128
|
-
return [2 /*return*/];
|
|
129
156
|
});
|
|
130
157
|
});
|
|
131
158
|
};
|
|
@@ -301,8 +328,30 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
301
328
|
};
|
|
302
329
|
SFUHandler.prototype.onTransportNotFound = function (data) {
|
|
303
330
|
return __awaiter(this, void 0, void 0, function () {
|
|
304
|
-
var messageJson;
|
|
305
|
-
return __generator(this, function (
|
|
331
|
+
var _i, _a, producer, _b, _c, consumer, messageJson;
|
|
332
|
+
return __generator(this, function (_d) {
|
|
333
|
+
for (_i = 0, _a = this.producers; _i < _a.length; _i++) {
|
|
334
|
+
producer = _a[_i];
|
|
335
|
+
if (producer) {
|
|
336
|
+
producer.close();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
for (_b = 0, _c = this.consumers; _b < _c.length; _b++) {
|
|
340
|
+
consumer = _c[_b];
|
|
341
|
+
if (consumer) {
|
|
342
|
+
consumer.close();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
this.producers = [];
|
|
346
|
+
this.consumers = [];
|
|
347
|
+
if (this.consumerTransport) {
|
|
348
|
+
this.consumerTransport.close();
|
|
349
|
+
this.consumerTransport = undefined;
|
|
350
|
+
}
|
|
351
|
+
if (this.sendTransport) {
|
|
352
|
+
this.sendTransport.close();
|
|
353
|
+
this.sendTransport = undefined;
|
|
354
|
+
}
|
|
306
355
|
messageJson = { to: "self", type: SFUMessageType.OnCreateTransports, message: SFUMessageType.OnCreateTransports };
|
|
307
356
|
this.sendSFUMessageToSocket(messageJson);
|
|
308
357
|
return [2 /*return*/];
|
|
@@ -339,7 +388,11 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
339
388
|
allProducers.forEach(function (eachProducer) {
|
|
340
389
|
var producerId = eachProducer.id;
|
|
341
390
|
var consumedProducer = _this.consumers.find(function (eachConsumer) { return eachConsumer.producerId === producerId; });
|
|
342
|
-
if (!consumedProducer) {
|
|
391
|
+
if (!consumedProducer || consumedProducer.closed) {
|
|
392
|
+
if (consumedProducer) {
|
|
393
|
+
consumedProducer.close();
|
|
394
|
+
_this.consumers = _this.consumers.filter(function (eachConsumer) { return eachConsumer.producerId !== producerId; });
|
|
395
|
+
}
|
|
343
396
|
_this.onNewProducer({ data: { message: { producer: eachProducer } } });
|
|
344
397
|
}
|
|
345
398
|
});
|