vani-meeting-client 1.1.6 → 1.1.7

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,44 @@ var SFUHandler = /** @class */ (function (_super) {
110
113
  });
111
114
  };
112
115
  SFUHandler.prototype.onRestartIceCandidateResponse = function (data) {
113
- var _a;
116
+ var _a, _b, _c;
114
117
  return __awaiter(this, void 0, void 0, function () {
115
- var transportId, iceParameters, messageJson;
116
- return __generator(this, function (_b) {
117
- transportId = data.message.transportId;
118
- iceParameters = data.message.iceParameters;
119
- if (this.consumerTransport && this.consumerTransport.id === transportId) {
120
- this.consumerTransport.restartIce({ iceParameters: iceParameters });
121
- }
122
- else if (this.sendTransport && this.sendTransport.id === transportId) {
123
- this.sendTransport.restartIce({ iceParameters: iceParameters });
118
+ var transportId, iceParameters, _i, _d, consumer, messageJson;
119
+ var _this = this;
120
+ return __generator(this, function (_e) {
121
+ switch (_e.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
+ return [4 /*yield*/, this.consumerTransport.restartIce({ iceParameters: iceParameters })];
128
+ case 1:
129
+ _e.sent();
130
+ for (_i = 0, _d = this.consumers; _i < _d.length; _i++) {
131
+ consumer = _d[_i];
132
+ if (consumer) {
133
+ consumer.close();
134
+ }
135
+ }
136
+ this.consumers = [];
137
+ messageJson = { to: "self", type: SFUMessageType.GetAllProducers, message: {} };
138
+ this.sendSFUMessageToSocket(messageJson);
139
+ return [3 /*break*/, 4];
140
+ case 2:
141
+ if (!(this.sendTransport && this.sendTransport.id === transportId)) return [3 /*break*/, 4];
142
+ return [4 /*yield*/, this.sendTransport.restartIce({ iceParameters: iceParameters })];
143
+ case 3:
144
+ _e.sent();
145
+ (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.getAllSelfTracks().forEach(function (eachSelfTrack) {
146
+ _this.stopTrack(eachSelfTrack);
147
+ });
148
+ (_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.getAllSelfTracks().forEach(function (eachSelfTrack) {
149
+ _this.sendTrack(eachSelfTrack);
150
+ });
151
+ _e.label = 4;
152
+ case 4: return [2 /*return*/];
124
153
  }
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
154
  });
130
155
  });
131
156
  };
@@ -301,8 +326,30 @@ var SFUHandler = /** @class */ (function (_super) {
301
326
  };
302
327
  SFUHandler.prototype.onTransportNotFound = function (data) {
303
328
  return __awaiter(this, void 0, void 0, function () {
304
- var messageJson;
305
- return __generator(this, function (_a) {
329
+ var _i, _a, producer, _b, _c, consumer, messageJson;
330
+ return __generator(this, function (_d) {
331
+ for (_i = 0, _a = this.producers; _i < _a.length; _i++) {
332
+ producer = _a[_i];
333
+ if (producer) {
334
+ producer.close();
335
+ }
336
+ }
337
+ for (_b = 0, _c = this.consumers; _b < _c.length; _b++) {
338
+ consumer = _c[_b];
339
+ if (consumer) {
340
+ consumer.close();
341
+ }
342
+ }
343
+ this.producers = [];
344
+ this.consumers = [];
345
+ if (this.consumerTransport) {
346
+ this.consumerTransport.close();
347
+ this.consumerTransport = undefined;
348
+ }
349
+ if (this.sendTransport) {
350
+ this.sendTransport.close();
351
+ this.sendTransport = undefined;
352
+ }
306
353
  messageJson = { to: "self", type: SFUMessageType.OnCreateTransports, message: SFUMessageType.OnCreateTransports };
307
354
  this.sendSFUMessageToSocket(messageJson);
308
355
  return [2 /*return*/];
@@ -339,7 +386,11 @@ var SFUHandler = /** @class */ (function (_super) {
339
386
  allProducers.forEach(function (eachProducer) {
340
387
  var producerId = eachProducer.id;
341
388
  var consumedProducer = _this.consumers.find(function (eachConsumer) { return eachConsumer.producerId === producerId; });
342
- if (!consumedProducer) {
389
+ if (!consumedProducer || consumedProducer.closed) {
390
+ if (consumedProducer) {
391
+ consumedProducer.close();
392
+ _this.consumers = _this.consumers.filter(function (eachConsumer) { return eachConsumer.producerId !== producerId; });
393
+ }
343
394
  _this.onNewProducer({ data: { message: { producer: eachProducer } } });
344
395
  }
345
396
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",