vani-meeting-client 2.1.2 → 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,13 @@ 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 === 2) {
80
+ if (count === 20) {
81
81
  _this.emitMessageToSource(VaniEvent.OnNotReachable, {});
82
+ if (_this.meetingStartRequest && _this.meetingStartRequest.isMobileApp) {
83
+ _this.emitMessageToSource(VaniEvent.OnSocketError, {});
84
+ }
82
85
  }
86
+ _this.emitMessageToSource(VaniEvent.CheckingInternetConnection, {});
83
87
  _this.isReachable = false;
84
88
  _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("checkIfInternetReachable");
85
89
  fetch(_this.meetingStartRequest.urlToCheckInternetPresent, {
@@ -93,7 +97,7 @@ var CommunicationHandler = /** @class */ (function () {
93
97
  .catch(function (error) {
94
98
  var _a;
95
99
  count = count + 1;
96
- _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.error('Error:', error);
100
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log('Error:', error);
97
101
  if (_this.meetingStartRequest) {
98
102
  if (_this.meetingStartRequest.shouldKeepTryToReconnect === false && count > 35) {
99
103
  _this.emitMessageToSource(VaniEvent.OnReconectionTimeout, {});
@@ -552,7 +556,7 @@ var CommunicationHandler = /** @class */ (function () {
552
556
  this.internetReachbilityTimeout = window.setTimeout(this.checkIfInternetReachable, 200, 0);
553
557
  };
554
558
  CommunicationHandler.prototype.onApiResponded = function (count) {
555
- var _a;
559
+ var _a, _b, _c;
556
560
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onApiResponded", count);
557
561
  if (this.isReachable === false) {
558
562
  this.isReachable = true;
@@ -560,7 +564,19 @@ var CommunicationHandler = /** @class */ (function () {
560
564
  // if (count < 2 && this.websocketCallHandler?.isWebScoketConnected()) {
561
565
  // this.videoCallHandler?.reconnectedWithoutPing()
562
566
  // }
563
- (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.reconnectedWithoutPing();
567
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onApiResponded inside", count);
568
+ if (this.meetingStartRequest && this.meetingStartRequest.isMobileApp) {
569
+ if ((_a = this.websocketCallHandler) === null || _a === void 0 ? void 0 : _a.isWebScoketConnected()) {
570
+ return;
571
+ }
572
+ this.websocketCallHandler.reconnectOnInternetFailur();
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
+ }
577
+ else {
578
+ this.websocketCallHandler.reconnectOnInternetFailur();
579
+ }
564
580
  }
565
581
  };
566
582
  CommunicationHandler.prototype.cleanup = function () {
@@ -29,6 +29,7 @@ export declare enum VaniEvent {
29
29
  OnOldMessages = "onOldMessages",
30
30
  OnSpeakerChanged = "onSpeakerChanged",
31
31
  OnAudioVolumeChanged = "OnAudioVolumeChanged",
32
+ CheckingInternetConnection = "CheckingInternetConnection",
32
33
  OnNotReachable = "notReachable",
33
34
  OnReconectionTimeout = "reconectionTimeout",
34
35
  OnReconecting = "reconecting",
@@ -45,6 +46,7 @@ interface VaniConnectionEvents {
45
46
  [VaniEvent.OnSocketError]: (error: any) => any;
46
47
  [VaniEvent.OnSocketConnected]: () => any;
47
48
  [VaniEvent.OnSocketReconnectTimeOut]: () => any;
49
+ [VaniEvent.CheckingInternetConnection]: () => any;
48
50
  [VaniEvent.OnConnected]: () => any;
49
51
  [VaniEvent.OnConnectionBack]: () => any;
50
52
  [VaniEvent.OnPermissionError]: (error: DOMException) => any;
@@ -27,6 +27,7 @@ export var VaniEvent;
27
27
  VaniEvent["OnOldMessages"] = "onOldMessages";
28
28
  VaniEvent["OnSpeakerChanged"] = "onSpeakerChanged";
29
29
  VaniEvent["OnAudioVolumeChanged"] = "OnAudioVolumeChanged";
30
+ VaniEvent["CheckingInternetConnection"] = "CheckingInternetConnection";
30
31
  VaniEvent["OnNotReachable"] = "notReachable";
31
32
  VaniEvent["OnReconectionTimeout"] = "reconectionTimeout";
32
33
  VaniEvent["OnReconecting"] = "reconecting";
@@ -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 {
@@ -278,9 +278,14 @@ var WebsocketHandler = /** @class */ (function (_super) {
278
278
  var _a;
279
279
  _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("wss error", event);
280
280
  _this.isWebSocketConnectionInProgress = false;
281
- (_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnSocketError, event);
282
- if (_this.wss) {
283
- _this.wss.close();
281
+ if (_this.meetingStartRequest && _this.meetingStartRequest.isMobileApp) {
282
+ _this.communicationHandler.onIceCandidateDisconnected();
283
+ }
284
+ else {
285
+ (_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnSocketError, event);
286
+ if (_this.wss) {
287
+ _this.wss.close();
288
+ }
284
289
  }
285
290
  };
286
291
  this.wss.onclose = function (event) {
@@ -315,12 +320,17 @@ var WebsocketHandler = /** @class */ (function (_super) {
315
320
  };
316
321
  WebsocketHandler.prototype.reconnectOnInternetFailur = function () {
317
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
+ }
318
328
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("reconnectOnInternetFailur");
319
329
  if (this.wss) {
320
330
  (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnReconecting, {});
321
331
  this.wss.close(3005);
322
332
  this.wss = undefined;
323
- 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 ");
324
334
  }
325
335
  this.connection = ConnectionType.reconnect;
326
336
  this.connect(true);
@@ -341,6 +351,9 @@ var WebsocketHandler = /** @class */ (function (_super) {
341
351
  var _a;
342
352
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onWebSocketClosed", event.code);
343
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
+ }
344
357
  this.socketCheckTimeout = window.setTimeout(function () {
345
358
  var _a;
346
359
  _this.tryToReconectSocket();
@@ -353,6 +366,9 @@ var WebsocketHandler = /** @class */ (function (_super) {
353
366
  };
354
367
  WebsocketHandler.prototype.tryToReconectSocket = function () {
355
368
  var _a, _b;
369
+ if (this.isWebSocketConnectionInProgress || this.isWebScoketConnected()) {
370
+ return;
371
+ }
356
372
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("tryToReconectSocket");
357
373
  if (this.isWebScoketConnected() === false && this.isEnded === false) {
358
374
  this.wss = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "2.1.2",
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
  }