vani-meeting-client 1.1.8 → 1.2.0

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.
@@ -29,6 +29,7 @@ export declare class MeetingHandler {
29
29
  pauseIncomingTrack(track: Track): void;
30
30
  resumeIncomingTrack(track: Track): void;
31
31
  updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
32
+ resumeProducerOrConsumerForTrack(track: Track): Promise<void>;
32
33
  participantByUserId(userId: string): Participant | undefined;
33
34
  updateParticipantData(participant: Participant): Participant | undefined;
34
35
  getUpdatedParticipantsListFromServer(): void;
@@ -265,6 +265,15 @@ var MeetingHandler = /** @class */ (function () {
265
265
  });
266
266
  });
267
267
  };
268
+ MeetingHandler.prototype.resumeProducerOrConsumerForTrack = function (track) {
269
+ var _a;
270
+ return __awaiter(this, void 0, void 0, function () {
271
+ return __generator(this, function (_b) {
272
+ (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.resumeProducerOrConsumerForTrack(track);
273
+ return [2 /*return*/];
274
+ });
275
+ });
276
+ };
268
277
  //Participant
269
278
  MeetingHandler.prototype.participantByUserId = function (userId) {
270
279
  var _a, _b, _c;
@@ -40,6 +40,7 @@ export declare class CommunicationHandler {
40
40
  getLocalTrackById(trackId: string): Track | undefined;
41
41
  getAllTracksForParticipant(participant: Participant): Track[];
42
42
  removeTrack(track: Track, shouldInfromVideoController?: boolean): void;
43
+ resumeProducerOrConsumerForTrack(track: Track): void;
43
44
  addUpdateRemoteTrack(track: Track, participant: Participant, shouldInfromIfNotExist?: boolean): Track;
44
45
  addUpdateLocalTrack(track: Track): void;
45
46
  onOldMessages(data: any): void;
@@ -234,6 +234,10 @@ var CommunicationHandler = /** @class */ (function () {
234
234
  Utility.deleteArrayObject(track, this.selfTracks);
235
235
  this.emitMessageToSource(VaniEvent.OnTrackEnded, track);
236
236
  };
237
+ CommunicationHandler.prototype.resumeProducerOrConsumerForTrack = function (track) {
238
+ var _a;
239
+ (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.resumeProducerOrConsumerForTrack(track);
240
+ };
237
241
  CommunicationHandler.prototype.addUpdateRemoteTrack = function (track, participant, shouldInfromIfNotExist) {
238
242
  if (shouldInfromIfNotExist === void 0) { shouldInfromIfNotExist = false; }
239
243
  var oldTrack = this.getTrackById(track.trackId);
@@ -15,7 +15,8 @@ export declare abstract class BaseVideoCallHandler extends Base {
15
15
  abstract onParticipantUpdated(): void;
16
16
  abstract createDataChannel(): any;
17
17
  abstract sendMessageViaDataChannel(messagePayload: any): any;
18
- updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
18
+ resumeProducerOrConsumerForTrack(track: Track): Promise<void>;
19
19
  reconnectedWithoutPing(): void;
20
+ updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
20
21
  cleanup(): void;
21
22
  }
@@ -61,7 +61,7 @@ var BaseVideoCallHandler = /** @class */ (function (_super) {
61
61
  _super.prototype.onObjectCreated.call(this);
62
62
  (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.setVideoCallHandler(this);
63
63
  };
64
- BaseVideoCallHandler.prototype.updateSpatialForTrack = function (track, spatialLayerIndex) {
64
+ BaseVideoCallHandler.prototype.resumeProducerOrConsumerForTrack = function (track) {
65
65
  return __awaiter(this, void 0, void 0, function () {
66
66
  return __generator(this, function (_a) {
67
67
  return [2 /*return*/];
@@ -70,6 +70,13 @@ var BaseVideoCallHandler = /** @class */ (function (_super) {
70
70
  };
71
71
  BaseVideoCallHandler.prototype.reconnectedWithoutPing = function () {
72
72
  };
73
+ BaseVideoCallHandler.prototype.updateSpatialForTrack = function (track, spatialLayerIndex) {
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ return __generator(this, function (_a) {
76
+ return [2 /*return*/];
77
+ });
78
+ });
79
+ };
73
80
  BaseVideoCallHandler.prototype.cleanup = function () {
74
81
  log.info("cleanup ");
75
82
  };
@@ -20,6 +20,7 @@ export declare class SFUHandler extends BaseVideoCallHandler {
20
20
  private onRestartIceCandidateResponse;
21
21
  stopTrack(track: Track): void;
22
22
  pauseTrack(track: Track): void;
23
+ resumeProducerOrConsumerForTrack(track: Track): Promise<void>;
23
24
  resumeTrack(track: Track): void;
24
25
  pauseIncomingTrack(track: Track): void;
25
26
  resumeIncomingTrack(track: Track): void;
@@ -113,44 +113,26 @@ var SFUHandler = /** @class */ (function (_super) {
113
113
  });
114
114
  };
115
115
  SFUHandler.prototype.onRestartIceCandidateResponse = function (data) {
116
- var _a, _b, _c, _d;
116
+ var _a;
117
117
  return __awaiter(this, void 0, void 0, function () {
118
- var transportId, iceParameters, _i, _e, consumer, messageJson;
119
- var _this = this;
120
- return __generator(this, function (_f) {
121
- switch (_f.label) {
118
+ var transportId, iceParameters;
119
+ return __generator(this, function (_b) {
120
+ switch (_b.label) {
122
121
  case 0:
123
122
  transportId = data.message.transportId;
124
123
  iceParameters = data.message.iceParameters;
125
124
  (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.downloadParticipantsData();
126
125
  if (!(this.consumerTransport && this.consumerTransport.id === transportId)) return [3 /*break*/, 2];
127
- console.log("restartIce", "communicationHandler");
128
126
  return [4 /*yield*/, this.consumerTransport.restartIce({ iceParameters: iceParameters })];
129
127
  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);
128
+ _b.sent();
140
129
  return [3 /*break*/, 4];
141
130
  case 2:
142
131
  if (!(this.sendTransport && this.sendTransport.id === transportId)) return [3 /*break*/, 4];
143
132
  return [4 /*yield*/, this.sendTransport.restartIce({ iceParameters: iceParameters })];
144
133
  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;
134
+ _b.sent();
135
+ _b.label = 4;
154
136
  case 4: return [2 /*return*/];
155
137
  }
156
138
  });
@@ -184,6 +166,25 @@ var SFUHandler = /** @class */ (function (_super) {
184
166
  }
185
167
  }
186
168
  };
169
+ SFUHandler.prototype.resumeProducerOrConsumerForTrack = function (track) {
170
+ return __awaiter(this, void 0, void 0, function () {
171
+ var producer, consumer;
172
+ return __generator(this, function (_a) {
173
+ console.log("resumeProducerOrConsumerForTrack");
174
+ producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
175
+ if (producer) {
176
+ producer.resume();
177
+ }
178
+ else {
179
+ consumer = this.consumers.find(function (consumer) { return consumer.appData.producerData.trackId === track.trackId; });
180
+ if (consumer) {
181
+ consumer.resume();
182
+ }
183
+ }
184
+ return [2 /*return*/];
185
+ });
186
+ });
187
+ };
187
188
  SFUHandler.prototype.resumeTrack = function (track) {
188
189
  var producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
189
190
  if (producer) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "1.1.8",
3
+ "version": "1.2.0",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",