vani-meeting-client 2.1.3 → 2.1.4

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.
@@ -77,9 +77,9 @@ var CommunicationHandler = /** @class */ (function () {
77
77
  (_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
78
78
  return;
79
79
  }
80
- if (count === 10) {
80
+ if (count === 20) {
81
81
  _this.emitMessageToSource(VaniEvent.OnNotReachable, {});
82
- if (_this.meetingStartRequest.isMobileApp) {
82
+ if (_this.meetingStartRequest && _this.meetingStartRequest.isMobileApp) {
83
83
  _this.emitMessageToSource(VaniEvent.OnSocketError, {});
84
84
  }
85
85
  }
@@ -97,7 +97,7 @@ var CommunicationHandler = /** @class */ (function () {
97
97
  .catch(function (error) {
98
98
  var _a;
99
99
  count = count + 1;
100
- _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.error('Error:', error);
100
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log('Error:', error);
101
101
  if (_this.meetingStartRequest) {
102
102
  if (_this.meetingStartRequest.shouldKeepTryToReconnect === false && count > 35) {
103
103
  _this.emitMessageToSource(VaniEvent.OnReconectionTimeout, {});
@@ -556,7 +556,7 @@ var CommunicationHandler = /** @class */ (function () {
556
556
  this.internetReachbilityTimeout = window.setTimeout(this.checkIfInternetReachable, 200, 0);
557
557
  };
558
558
  CommunicationHandler.prototype.onApiResponded = function (count) {
559
- var _a;
559
+ var _a, _b, _c;
560
560
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onApiResponded", count);
561
561
  if (this.isReachable === false) {
562
562
  this.isReachable = true;
@@ -564,11 +564,18 @@ var CommunicationHandler = /** @class */ (function () {
564
564
  // if (count < 2 && this.websocketCallHandler?.isWebScoketConnected()) {
565
565
  // this.videoCallHandler?.reconnectedWithoutPing()
566
566
  // }
567
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onApiResponded inside", count);
567
568
  if (this.meetingStartRequest && this.meetingStartRequest.isMobileApp) {
569
+ if ((_a = this.websocketCallHandler) === null || _a === void 0 ? void 0 : _a.isWebScoketConnected()) {
570
+ return;
571
+ }
568
572
  this.websocketCallHandler.reconnectOnInternetFailur();
569
573
  }
574
+ else if ((_b = this.websocketCallHandler) === null || _b === void 0 ? void 0 : _b.isWebScoketConnected()) {
575
+ (_c = this.videoCallHandler) === null || _c === void 0 ? void 0 : _c.reconnectedWithoutPing();
576
+ }
570
577
  else {
571
- (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.reconnectedWithoutPing();
578
+ this.websocketCallHandler.reconnectOnInternetFailur();
572
579
  }
573
580
  }
574
581
  };
@@ -543,6 +543,7 @@ var SFUHandler = /** @class */ (function (_super) {
543
543
  this.sendTransport = undefined;
544
544
  }
545
545
  this.isProduceTrackIntialWorkDone = false;
546
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("OnCreateTransportsForcefully");
546
547
  messageJson = { to: "self", type: SFUMessageType.OnCreateTransportsForcefully, message: SFUMessageType.OnCreateTransportsForcefully };
547
548
  this.sendSFUMessageToSocket(messageJson);
548
549
  return [2 /*return*/];
@@ -603,6 +604,7 @@ var SFUHandler = /** @class */ (function (_super) {
603
604
  this.device.load({ routerRtpCapabilities: routerRtpCapabilities });
604
605
  this.isProduceTrackIntialWorkDone = false;
605
606
  //Create transport
607
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("OnCreateTransports onRouterRtpCapabilities");
606
608
  var messageJson = { to: "self", type: SFUMessageType.OnCreateTransports, message: SFUMessageType.OnCreateTransports };
607
609
  this.sendSFUMessageToSocket(messageJson);
608
610
  }
@@ -626,6 +628,7 @@ var SFUHandler = /** @class */ (function (_super) {
626
628
  var _a;
627
629
  _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log(" onSendTransport produce");
628
630
  _this.transportCallBacks[producerLocalParameters.appData.trackId] = callback;
631
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("OnTransportProduceSyncRequest");
629
632
  var messageJson = { to: "self", type: SFUMessageType.OnTransportProduceSyncRequest, message: { type: producerLocalParameters.appData.type, transportId: (_a = _this.sendTransport) === null || _a === void 0 ? void 0 : _a.id, kind: producerLocalParameters.kind, rtpParameters: producerLocalParameters.rtpParameters, appData: producerLocalParameters.appData } };
630
633
  _this.sendSFUMessageToSocket(messageJson);
631
634
  });
@@ -667,12 +670,14 @@ var SFUHandler = /** @class */ (function (_super) {
667
670
  SFUHandler.prototype.produceTracks = function () {
668
671
  var _this = this;
669
672
  var _a, _b;
670
- this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("produceTracks");
673
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("produceTracks", this.sendTransport, this.consumerTransport, this.isProduceTrackIntialWorkDone);
671
674
  if (!this.sendTransport || !this.consumerTransport || this.isProduceTrackIntialWorkDone) {
675
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("produceTracks", this.sendTransport, this.consumerTransport, this.isProduceTrackIntialWorkDone);
672
676
  return;
673
677
  }
674
678
  this.isProduceTrackIntialWorkDone = true;
675
679
  var selfTracks = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getAllSelfTracks();
680
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("produceTracks selfTracks", selfTracks);
676
681
  if (selfTracks && selfTracks.length > 0) {
677
682
  selfTracks.forEach(function (track) {
678
683
  _this.sendTrack(track);
@@ -715,6 +720,7 @@ var SFUHandler = /** @class */ (function (_super) {
715
720
  this.onTransportConnectDone(websocketCallHandler.data);
716
721
  }
717
722
  else if (websocketCallHandler.type === SFUMessageType.OnSendTransport) {
723
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("OnSendTransport");
718
724
  this.onSendTransport(websocketCallHandler.data);
719
725
  }
720
726
  else if (websocketCallHandler.type === SFUMessageType.OnConsumeTransport) {
@@ -256,7 +256,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
256
256
  if (url) {
257
257
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Connecting to ", url);
258
258
  this.isWebSocketConnectionInProgress = true;
259
- if ((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.isMobileApp) {
259
+ if (this.meetingStartRequest && ((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.isMobileApp)) {
260
260
  this.wss = new WebSocket(url + this.connection);
261
261
  }
262
262
  else {
@@ -277,11 +277,11 @@ var WebsocketHandler = /** @class */ (function (_super) {
277
277
  this.wss.onerror = function (event) {
278
278
  var _a;
279
279
  _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("wss error", event);
280
- if (_this.meetingStartRequest.isMobileApp) {
280
+ _this.isWebSocketConnectionInProgress = false;
281
+ if (_this.meetingStartRequest && _this.meetingStartRequest.isMobileApp) {
281
282
  _this.communicationHandler.onIceCandidateDisconnected();
282
283
  }
283
284
  else {
284
- _this.isWebSocketConnectionInProgress = false;
285
285
  (_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnSocketError, event);
286
286
  if (_this.wss) {
287
287
  _this.wss.close();
@@ -320,12 +320,17 @@ var WebsocketHandler = /** @class */ (function (_super) {
320
320
  };
321
321
  WebsocketHandler.prototype.reconnectOnInternetFailur = function () {
322
322
  var _a;
323
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug &&
324
+ log.info("reconnectOnInternetFailur on start", this.isWebScoketConnected(), this.isWebSocketConnectionInProgress);
325
+ if (this.isWebScoketConnected() || this.isWebSocketConnectionInProgress) {
326
+ return;
327
+ }
323
328
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("reconnectOnInternetFailur");
324
329
  if (this.wss) {
325
330
  (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnReconecting, {});
326
331
  this.wss.close(3005);
327
332
  this.wss = undefined;
328
- this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("this.wss undefined reconnectOnInternetFailur ");
333
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("this.wss reconnectOnInternetFailur ");
329
334
  }
330
335
  this.connection = ConnectionType.reconnect;
331
336
  this.connect(true);
@@ -346,6 +351,9 @@ var WebsocketHandler = /** @class */ (function (_super) {
346
351
  var _a;
347
352
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onWebSocketClosed", event.code);
348
353
  if (event.code === 3005 || event.wasClean === false || (event.message && event.message.toLowerCase().includes("software") && event.message.toLowerCase().includes("abort")) || (event.message && event.message.toLowerCase().includes("no address"))) {
354
+ if (this.isWebSocketConnectionInProgress) {
355
+ return;
356
+ }
349
357
  this.socketCheckTimeout = window.setTimeout(function () {
350
358
  var _a;
351
359
  _this.tryToReconectSocket();
@@ -358,6 +366,9 @@ var WebsocketHandler = /** @class */ (function (_super) {
358
366
  };
359
367
  WebsocketHandler.prototype.tryToReconectSocket = function () {
360
368
  var _a, _b;
369
+ if (this.isWebSocketConnectionInProgress || this.isWebScoketConnected()) {
370
+ return;
371
+ }
361
372
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("tryToReconectSocket");
362
373
  if (this.isWebScoketConnected() === false && this.isEnded === false) {
363
374
  this.wss = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "axios": "^0.24.0",
46
46
  "loglevel": "^1.8.0",
47
- "mediasoup-client": "3.16.7"
47
+ "mediasoup-client": "3.18.3"
48
48
  },
49
49
  "optionalDependencies": {}
50
50
  }