vani-meeting-client 1.1.4 → 1.1.6

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.
@@ -131,7 +131,7 @@ var CommunicationHandler = /** @class */ (function () {
131
131
  return this.allParticipants.find(function (participant) { return participant.userId === userId; });
132
132
  };
133
133
  CommunicationHandler.prototype.addParticipantIfNotExist = function (participant, shouldInfrom) {
134
- var _a;
134
+ var _a, _b, _c;
135
135
  if (shouldInfrom === void 0) { shouldInfrom = false; }
136
136
  console.log("addParticipantIfNotExist", this.allParticipants);
137
137
  console.log("addParticipantIfNotExist new user", participant);
@@ -145,26 +145,30 @@ var CommunicationHandler = /** @class */ (function () {
145
145
  this.emitMessageToSource(VaniEvent.OnParticipantDataUpdated, oldParticipant);
146
146
  }
147
147
  this.updateParticipantAudioVideoDataAccordingToTrack(oldParticipant);
148
- // try {
149
- // if (oldParticipant.userId === this.meetingStartRequest?.userId) {
150
- // this.meetingStartRequest.userData = oldParticipant.userData
151
- // }
152
- // }
153
- // catch (err) {
154
- // }
148
+ try {
149
+ if (oldParticipant.userId === ((_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId)) {
150
+ this.meetingStartRequest.userData = oldParticipant.userData;
151
+ }
152
+ }
153
+ catch (err) {
154
+ }
155
155
  return oldParticipant;
156
156
  }
157
157
  else {
158
158
  participant = Object.assign(new Participant(participant.userId, participant.roomId, participant.userData, participant.isAdmin), participant);
159
159
  this.updateParticipantAudioVideoDataAccordingToTrack(participant);
160
- // if (participant.userId === this.meetingStartRequest?.userId) {
161
- // this.meetingStartRequest.userData = participant.userData
162
- // }
160
+ try {
161
+ if (participant.userId === ((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.userId)) {
162
+ this.meetingStartRequest.userData = participant.userData;
163
+ }
164
+ }
165
+ catch (err) {
166
+ }
163
167
  this.allParticipants.push(participant);
164
168
  if (shouldInfrom) {
165
169
  this.emitMessageToSource(VaniEvent.OnUserJoined, participant);
166
170
  }
167
- (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.onParticipantUpdated();
171
+ (_c = this.videoCallHandler) === null || _c === void 0 ? void 0 : _c.onParticipantUpdated();
168
172
  return participant;
169
173
  }
170
174
  };
@@ -196,22 +196,25 @@ var SFUHandler = /** @class */ (function (_super) {
196
196
  });
197
197
  };
198
198
  SFUHandler.prototype.sendTrack = function (track) {
199
- var _a, _b, _c;
199
+ var _a, _b, _c, _d, _e;
200
200
  return __awaiter(this, void 0, void 0, function () {
201
201
  var producer, appData, producerData, webcamProducer;
202
- return __generator(this, function (_d) {
203
- switch (_d.label) {
202
+ return __generator(this, function (_f) {
203
+ switch (_f.label) {
204
204
  case 0:
205
205
  if (!(track && track.track)) return [3 /*break*/, 4];
206
206
  producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
207
- if (!(producer && producer.closed === false)) return [3 /*break*/, 2];
207
+ if (producer && producer.closed === false && ((_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.isMobileApp)) {
208
+ this.stopTrack(track);
209
+ }
210
+ if (!(producer && producer.closed === false && ((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.isMobileApp) === false)) return [3 /*break*/, 2];
208
211
  return [4 /*yield*/, producer.replaceTrack({ track: track.track })];
209
212
  case 1:
210
- _d.sent();
213
+ _f.sent();
211
214
  this.resumeTrack(track);
212
215
  return [3 /*break*/, 4];
213
216
  case 2:
214
- appData = __assign({}, (_a = this.sendTransport) === null || _a === void 0 ? void 0 : _a.appData);
217
+ appData = __assign({}, (_c = this.sendTransport) === null || _c === void 0 ? void 0 : _c.appData);
215
218
  appData.trackKind = track.trackKind;
216
219
  appData.trackId = track.trackId;
217
220
  producerData = { track: track.track, appData: appData, disableTrackOnPause: false, zeroRtpOnPause: true };
@@ -221,13 +224,13 @@ var SFUHandler = /** @class */ (function (_super) {
221
224
  if (track.track.kind === "audio") {
222
225
  producerData.codecOptions = { opusStereo: true, opusFec: true };
223
226
  if (this.meetingStartRequest.maxAudioBitrateConfig > 0) {
224
- producerData.codecOptions.opusMaxAverageBitrate = (_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.maxAudioBitrateConfig;
227
+ producerData.codecOptions.opusMaxAverageBitrate = (_d = this.meetingStartRequest) === null || _d === void 0 ? void 0 : _d.maxAudioBitrateConfig;
225
228
  }
226
229
  }
227
230
  log.info(producerData);
228
- return [4 /*yield*/, ((_c = this.sendTransport) === null || _c === void 0 ? void 0 : _c.produce(producerData))];
231
+ return [4 /*yield*/, ((_e = this.sendTransport) === null || _e === void 0 ? void 0 : _e.produce(producerData))];
229
232
  case 3:
230
- webcamProducer = _d.sent();
233
+ webcamProducer = _f.sent();
231
234
  if (webcamProducer) {
232
235
  console.log("On webcamProducer");
233
236
  this.producers.push(webcamProducer);
@@ -237,7 +240,7 @@ var SFUHandler = /** @class */ (function (_super) {
237
240
  else {
238
241
  console.log("On webcamProducer not created");
239
242
  }
240
- _d.label = 4;
243
+ _f.label = 4;
241
244
  case 4: return [2 /*return*/];
242
245
  }
243
246
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",