vani-meeting-client 1.7.9 → 1.8.1

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.
@@ -472,7 +472,7 @@ var MeetingHandler = /** @class */ (function () {
472
472
  });
473
473
  };
474
474
  MeetingHandler.prototype.cleanup = function () {
475
- var _a, _b, _c;
475
+ var _a, _b, _c, _d;
476
476
  this.meetingStartRequest = undefined;
477
477
  this.reactNativeWebrtcPlugin = undefined;
478
478
  (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.cleanup();
@@ -481,6 +481,8 @@ var MeetingHandler = /** @class */ (function () {
481
481
  this.videoCallHandler = undefined;
482
482
  (_c = this.websocketCallHandler) === null || _c === void 0 ? void 0 : _c.cleanup();
483
483
  this.websocketCallHandler = undefined;
484
+ (_d = this.userMediaHandler) === null || _d === void 0 ? void 0 : _d.cleanup();
485
+ this.userMediaHandler = undefined;
484
486
  };
485
487
  MeetingHandler.prototype.handleGA = function () {
486
488
  return __awaiter(this, void 0, void 0, function () {
@@ -172,10 +172,10 @@ var CommunicationHandler = /** @class */ (function () {
172
172
  userIds = userIds + " " + userId;
173
173
  _this.addParticipantIfNotExist(participant, false);
174
174
  });
175
- var allParticiapntsToBeRemove = this.allParticipants.filter(function (participant) { return (userIds.includes(participant.userId) === false); });
176
- allParticiapntsToBeRemove.forEach(function (participant) {
177
- _this.removeParticipant(participant, true);
178
- });
175
+ // const allParticiapntsToBeRemove = this.allParticipants.filter(participant => (userIds.includes(participant.userId) === false))
176
+ // allParticiapntsToBeRemove.forEach(participant => {
177
+ // this.removeParticipant(participant, true);
178
+ // })
179
179
  this.emitMessageToSource(VaniEvent.OnAllParticipants, this.allParticipants);
180
180
  }
181
181
  };
@@ -13,6 +13,7 @@ export declare class UserMediaHandler extends Base {
13
13
  private cameraFacingMode?;
14
14
  private videoPauseResumePromiseResolver?;
15
15
  private muteUmutePromiseResolver?;
16
+ private tracks;
16
17
  private userMediaPayload?;
17
18
  switchCamera(): Promise<void>;
18
19
  startScreenShare(isAudioRequired?: boolean, shouldAddTrackImmediately?: boolean, screensharePayload?: any): Promise<void>;
@@ -33,4 +34,5 @@ export declare class UserMediaHandler extends Base {
33
34
  unmute(userId?: string): Promise<TaskResponse>;
34
35
  pauseStreamWithoutStopping(streamKind: TrackKind): TaskResponse;
35
36
  resumeStreamWithoutAdding(streamKind: TrackKind): TaskResponse;
37
+ cleanup(): void;
36
38
  }
@@ -67,6 +67,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
67
67
  var _this = _super !== null && _super.apply(this, arguments) || this;
68
68
  _this.isVideoAudioFetchInProgress = false;
69
69
  _this.isScreenShareFetchInProgress = false;
70
+ _this.tracks = [];
70
71
  _this.registerForDeviceChange = function () { return __awaiter(_this, void 0, void 0, function () {
71
72
  var mediaDevice;
72
73
  var _this = this;
@@ -328,11 +329,29 @@ var UserMediaHandler = /** @class */ (function (_super) {
328
329
  var _a, _b, _c, _d, _e;
329
330
  return __awaiter(this, void 0, void 0, function () {
330
331
  var permissionApprovedFor, data, audioPause, data, audioPause;
332
+ var _this = this;
331
333
  return __generator(this, function (_f) {
334
+ try {
335
+ if (stream && stream.getVideoTracks()) {
336
+ stream.getVideoTracks().forEach(function (eachMediaTrack) {
337
+ _this.tracks.push(eachMediaTrack);
338
+ });
339
+ }
340
+ if (stream && stream.getAudioTracks()) {
341
+ stream.getAudioTracks().forEach(function (eachMediaTrack) {
342
+ _this.tracks.push(eachMediaTrack);
343
+ });
344
+ }
345
+ }
346
+ catch (err) {
347
+ }
332
348
  if (!stream || (isForAudio === false && isForVideo === false)) {
333
349
  this.isVideoAudioFetchInProgress = false;
334
350
  return [2 /*return*/];
335
351
  }
352
+ if (!this.communicationHandler.getSelfParticipant()) {
353
+ return [2 /*return*/];
354
+ }
336
355
  permissionApprovedFor = [];
337
356
  if (isForAudio && stream.getAudioTracks().length > 0) {
338
357
  this.onTrack(stream.getAudioTracks()[0], TrackKind.Audio, shouldAddTrackImmediately);
@@ -389,7 +408,22 @@ var UserMediaHandler = /** @class */ (function (_super) {
389
408
  var _a;
390
409
  return __awaiter(this, void 0, void 0, function () {
391
410
  var permissionApprovedFor;
411
+ var _this = this;
392
412
  return __generator(this, function (_b) {
413
+ try {
414
+ if (stream && stream.getVideoTracks()) {
415
+ stream.getVideoTracks().forEach(function (eachMediaTrack) {
416
+ _this.tracks.push(eachMediaTrack);
417
+ });
418
+ }
419
+ if (stream && stream.getAudioTracks()) {
420
+ stream.getAudioTracks().forEach(function (eachMediaTrack) {
421
+ _this.tracks.push(eachMediaTrack);
422
+ });
423
+ }
424
+ }
425
+ catch (err) {
426
+ }
393
427
  permissionApprovedFor = [];
394
428
  if (stream.getVideoTracks().length > 0) {
395
429
  this.onTrack(stream.getVideoTracks()[0], TrackKind.ScreenshareVideo, shouldAddTrackImmediately);
@@ -737,6 +771,16 @@ var UserMediaHandler = /** @class */ (function (_super) {
737
771
  return ({ message: "No Track Found", error: 'NoDevice', isSuccess: false });
738
772
  }
739
773
  };
774
+ UserMediaHandler.prototype.cleanup = function () {
775
+ this.tracks.forEach(function (eachTrack) {
776
+ try {
777
+ eachTrack.stop();
778
+ }
779
+ catch (err) {
780
+ }
781
+ });
782
+ _super.prototype.cleanup.call(this);
783
+ };
740
784
  return UserMediaHandler;
741
785
  }(Base));
742
786
  export { UserMediaHandler };
@@ -89,6 +89,7 @@ var BaseVideoCallHandler = /** @class */ (function (_super) {
89
89
  };
90
90
  BaseVideoCallHandler.prototype.cleanup = function () {
91
91
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("cleanup ");
92
+ _super.prototype.cleanup.call(this);
92
93
  };
93
94
  BaseVideoCallHandler.prototype.restartTransport = function () {
94
95
  };
@@ -804,6 +804,7 @@ var SFUHandler = /** @class */ (function (_super) {
804
804
  consumer.close();
805
805
  }
806
806
  });
807
+ _super.prototype.cleanup.call(this);
807
808
  };
808
809
  return SFUHandler;
809
810
  }(BaseVideoCallHandler));
@@ -179,6 +179,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
179
179
  window.clearTimeout(this.pingCheckTimeout);
180
180
  this.pingCheckTimeout = undefined;
181
181
  }
182
+ _super.prototype.cleanup.call(this);
182
183
  };
183
184
  WebsocketHandler.prototype.startSocketConnection = function () {
184
185
  return __awaiter(this, void 0, void 0, function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "1.7.9",
3
+ "version": "1.8.1",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",