vani-meeting-client 1.6.6 → 1.6.7

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.
@@ -377,7 +377,7 @@ var MeetingHandler = /** @class */ (function () {
377
377
  MeetingHandler.prototype.getOldMessages = function () {
378
378
  return __awaiter(this, void 0, void 0, function () {
379
379
  return __generator(this, function (_a) {
380
- log.info("getOldMessages");
380
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("getOldMessages");
381
381
  if (this.websocketCallHandler) {
382
382
  this.websocketCallHandler.sendSocketMessage(WebSocketBasicEvents.GetOldMessages, {});
383
383
  }
@@ -388,7 +388,7 @@ var MeetingHandler = /** @class */ (function () {
388
388
  MeetingHandler.prototype.onOldMessages = function (data) {
389
389
  return __awaiter(this, void 0, void 0, function () {
390
390
  return __generator(this, function (_a) {
391
- log.info(data);
391
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
392
392
  return [2 /*return*/];
393
393
  });
394
394
  });
@@ -404,7 +404,7 @@ var MeetingHandler = /** @class */ (function () {
404
404
  log.error("Init method not called");
405
405
  return [2 /*return*/];
406
406
  }
407
- log.info("checkSocket");
407
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("checkSocket");
408
408
  this.websocketCallHandler.startSocketConnection();
409
409
  return [2 /*return*/];
410
410
  });
package/lib/base/Base.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { LogLevel } from "..";
1
2
  import * as log from 'loglevel';
2
3
  var Base = /** @class */ (function () {
3
4
  function Base(_meetingStartRequest, _communicationHandler) {
@@ -6,12 +7,12 @@ var Base = /** @class */ (function () {
6
7
  this.onObjectCreated();
7
8
  }
8
9
  Base.prototype.onObjectCreated = function () {
9
- log.info("Object created");
10
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Object created");
10
11
  };
11
12
  Base.prototype.cleanup = function () {
12
13
  this.communicationHandler = undefined;
13
14
  this.meetingStartRequest = undefined;
14
- log.info("cleanup");
15
+ // this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug &&log.info("cleanup");
15
16
  };
16
17
  return Base;
17
18
  }());
@@ -157,7 +157,7 @@ var CommunicationHandler = /** @class */ (function () {
157
157
  };
158
158
  CommunicationHandler.prototype.onServerParticipants = function (data) {
159
159
  var _this = this;
160
- log.info(data);
160
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
161
161
  if (data && data.message) {
162
162
  var userIds = "";
163
163
  Object.entries(data.message).forEach(function (_a) {
@@ -310,11 +310,11 @@ var CommunicationHandler = /** @class */ (function () {
310
310
  if (shouldInfromIfNotExist === void 0) { shouldInfromIfNotExist = false; }
311
311
  var oldTrack = this.getTrackById(track.trackId);
312
312
  if (oldTrack) {
313
- log.info("oldtrack found");
313
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("oldtrack found");
314
314
  track = Object.assign(oldTrack, track);
315
315
  }
316
316
  else {
317
- log.info("new track found");
317
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("new track found");
318
318
  track = Object.assign(new Track(participant, track.isLocalTrack, track.trackKind, track.track), track);
319
319
  this.allTracks.push(track);
320
320
  }
@@ -326,7 +326,7 @@ var CommunicationHandler = /** @class */ (function () {
326
326
  track.participant.isVideoEnable = true;
327
327
  }
328
328
  if (shouldInfromIfNotExist) {
329
- log.info("emitMessageToSource");
329
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("emitMessageToSource");
330
330
  this.emitMessageToSource(VaniEvent.OnTrack, track);
331
331
  }
332
332
  return track;
@@ -420,7 +420,7 @@ var CommunicationHandler = /** @class */ (function () {
420
420
  if (this.isStartAndSetupWithServerCalled) {
421
421
  return;
422
422
  }
423
- log.info("onStartAndSetupWithServerCalled");
423
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onStartAndSetupWithServerCalled");
424
424
  this.isStartAndSetupWithServerCalled = true;
425
425
  var data = { user: (_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId };
426
426
  var startMeetingCalled = { message: data, type: WebSocketBasicEvents.OnStartMeetingCalled, to: (_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.roomId };
@@ -433,7 +433,7 @@ var CommunicationHandler = /** @class */ (function () {
433
433
  };
434
434
  CommunicationHandler.prototype.onAudioBlocked = function (data) {
435
435
  var _a, _b, _c;
436
- log.info(data);
436
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
437
437
  if (data.message.user) {
438
438
  var participant = this.participantByUserId(data.message.user);
439
439
  if (participant) {
@@ -446,7 +446,7 @@ var CommunicationHandler = /** @class */ (function () {
446
446
  }
447
447
  };
448
448
  CommunicationHandler.prototype.onAudioUnblocked = function (data) {
449
- log.info(data);
449
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
450
450
  if (data.message.user) {
451
451
  var participant = this.participantByUserId(data.message.user);
452
452
  if (participant) {
@@ -457,7 +457,7 @@ var CommunicationHandler = /** @class */ (function () {
457
457
  };
458
458
  CommunicationHandler.prototype.onVideoBlocked = function (data) {
459
459
  var _a, _b, _c;
460
- log.info(data);
460
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
461
461
  if (data.message.user) {
462
462
  var participant = this.participantByUserId(data.message.user);
463
463
  if (participant) {
@@ -470,7 +470,7 @@ var CommunicationHandler = /** @class */ (function () {
470
470
  }
471
471
  };
472
472
  CommunicationHandler.prototype.onVideoUnblocked = function (data) {
473
- log.info(data);
473
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
474
474
  if (data.message.user) {
475
475
  var participant = this.participantByUserId(data.message.user);
476
476
  if (participant) {
@@ -300,7 +300,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
300
300
  userMediaPayload.audio.deviceId = this.meetingStartRequest.audioInDevice;
301
301
  }
302
302
  }
303
- log.info(userMediaPayload);
303
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(userMediaPayload);
304
304
  (new DynamicLibHelper()).getMediaDevicesVariable(this.meetingStartRequest).getUserMedia(userMediaPayload)
305
305
  .then(function (stream) {
306
306
  _this.onStreamGot(stream, isAudioRequired, isVideoRequired, shouldAddTrackImmediately);
@@ -51,6 +51,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
51
51
  };
52
52
  import { Base } from "../base/Base";
53
53
  import log from 'loglevel';
54
+ import { LogLevel } from "../model/MeetingStartRequest";
54
55
  var BaseVideoCallHandler = /** @class */ (function (_super) {
55
56
  __extends(BaseVideoCallHandler, _super);
56
57
  function BaseVideoCallHandler() {
@@ -87,7 +88,7 @@ var BaseVideoCallHandler = /** @class */ (function (_super) {
87
88
  });
88
89
  };
89
90
  BaseVideoCallHandler.prototype.cleanup = function () {
90
- log.info("cleanup ");
91
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("cleanup ");
91
92
  };
92
93
  return BaseVideoCallHandler;
93
94
  }(Base));
@@ -98,7 +98,7 @@ var SFUHandler = /** @class */ (function (_super) {
98
98
  return __awaiter(this, void 0, void 0, function () {
99
99
  var data, data;
100
100
  return __generator(this, function (_a) {
101
- log.info("SFU onReconnect");
101
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("SFU onReconnect");
102
102
  if (this.sendTransport &&
103
103
  (this.sendTransport.connectionState === "disconnected" || this.sendTransport.connectionState === "failed" || this.sendTransport.connectionState === "new")) {
104
104
  data = { to: "self", message: { transportId: this.sendTransport.id }, "type": SFUMessageType.OnRestartIceCandidate };
@@ -250,7 +250,7 @@ var SFUHandler = /** @class */ (function (_super) {
250
250
  return __awaiter(this, void 0, void 0, function () {
251
251
  var consumer, messageJson;
252
252
  return __generator(this, function (_a) {
253
- log.info("updateSpatialForTrack");
253
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("updateSpatialForTrack");
254
254
  consumer = this.consumers.find(function (consumer) { return consumer.appData.producerData.trackId === track.trackId; });
255
255
  if (consumer) {
256
256
  messageJson = { to: "self", type: SFUMessageType.UpdateSpatialConsumer, message: { id: consumer.id, spatialLayer: spatialLayerIndex } };
@@ -303,7 +303,7 @@ var SFUHandler = /** @class */ (function (_super) {
303
303
  producerData.codecOptions.opusMaxAverageBitrate = (_d = this.meetingStartRequest) === null || _d === void 0 ? void 0 : _d.maxAudioBitrateConfig;
304
304
  }
305
305
  }
306
- log.info(producerData);
306
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(producerData);
307
307
  return [4 /*yield*/, ((_e = this.sendTransport) === null || _e === void 0 ? void 0 : _e.produce(producerData))];
308
308
  case 3:
309
309
  webcamProducer = _f.sent();
@@ -372,7 +372,7 @@ var SFUHandler = /** @class */ (function (_super) {
372
372
  return __awaiter(this, void 0, void 0, function () {
373
373
  var messageJson;
374
374
  return __generator(this, function (_a) {
375
- log.info("SFU Init");
375
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("SFU Init");
376
376
  messageJson = { to: "self", type: SFUMessageType.GetRouterRtpCapabilities, message: SFUMessageType.GetRouterRtpCapabilities };
377
377
  this.sendSFUMessageToSocket(messageJson);
378
378
  this.addObserverForDevice();
@@ -471,7 +471,7 @@ var SFUHandler = /** @class */ (function (_super) {
471
471
  if (data && data.message && data.message.rtpCapabilities) {
472
472
  this.routerRtpCapabilities = data.message.rtpCapabilities;
473
473
  var routerRtpCapabilities = this.routerRtpCapabilities;
474
- log.info(routerRtpCapabilities);
474
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(routerRtpCapabilities);
475
475
  this.device.load({ routerRtpCapabilities: routerRtpCapabilities });
476
476
  this.isProduceTrackIntialWorkDone = false;
477
477
  //Create transport
@@ -539,7 +539,7 @@ var SFUHandler = /** @class */ (function (_super) {
539
539
  SFUHandler.prototype.produceTracks = function () {
540
540
  var _this = this;
541
541
  var _a;
542
- log.info("produceTracks");
542
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("produceTracks");
543
543
  if (!this.sendTransport || !this.consumerTransport || this.isProduceTrackIntialWorkDone) {
544
544
  return;
545
545
  }
@@ -620,7 +620,7 @@ var SFUHandler = /** @class */ (function (_super) {
620
620
  };
621
621
  SFUHandler.prototype.onTrackEnded = function (data) {
622
622
  var _a, _b, _c;
623
- log.info("onTrackEnded");
623
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onTrackEnded");
624
624
  if (data && data.message && data.message.producerId) {
625
625
  var producerId_1 = data.message.producerId;
626
626
  var consumer = this.consumers.find(function (consumer) { return consumer.appData.producerData.producerId === producerId_1; });
@@ -672,8 +672,8 @@ var SFUHandler = /** @class */ (function (_super) {
672
672
  var consumerObj, consumerObj;
673
673
  var _this = this;
674
674
  return __generator(this, function (_a) {
675
- log.info("onServerConsumer");
676
- log.info(data);
675
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onServerConsumer");
676
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
677
677
  if (this.consumerTransport && data && data.message && data.message.consumer) {
678
678
  if (data.message.consumer.appData.producerData.trackKind === TrackKind.DataChannel) {
679
679
  consumerObj = data.message.consumer;
@@ -699,7 +699,7 @@ var SFUHandler = /** @class */ (function (_super) {
699
699
  _this.consumers.push(consumer);
700
700
  var mediaTrack = consumer.track;
701
701
  var data = consumer.appData.producerData;
702
- log.info(data);
702
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
703
703
  var participant = (_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.participantByUserId(data.participant.userId);
704
704
  if (!participant) {
705
705
  participant = (_b = _this.communicationHandler) === null || _b === void 0 ? void 0 : _b.addParticipantIfNotExist(data.participant, true);
@@ -51,6 +51,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
51
51
  };
52
52
  import { BaseVideoCallHandler } from "./BaseVideoCallHandler";
53
53
  import log from 'loglevel';
54
+ import { LogLevel } from "../model/MeetingStartRequest";
54
55
  var WebrtcHandler = /** @class */ (function (_super) {
55
56
  __extends(WebrtcHandler, _super);
56
57
  function WebrtcHandler() {
@@ -71,7 +72,7 @@ var WebrtcHandler = /** @class */ (function (_super) {
71
72
  WebrtcHandler.prototype.init = function () {
72
73
  return __awaiter(this, void 0, void 0, function () {
73
74
  return __generator(this, function (_a) {
74
- log.info("Webrtc Init");
75
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Webrtc Init");
75
76
  return [2 /*return*/];
76
77
  });
77
78
  });
@@ -192,7 +192,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
192
192
  }
193
193
  request = { meeting_id: this.meetingStartRequest.roomId, estimated_users: this.meetingStartRequest.numberOfUsers };
194
194
  urlToGetIpAddress = this.meetingStartRequest.dynamicWebSocketFetchBaseUrl + "api/getIpAddressForMeeting";
195
- log.info(JSON.stringify(request));
195
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(JSON.stringify(request));
196
196
  config = {
197
197
  headers: {
198
198
  'Content-Type': 'application/json'
@@ -201,7 +201,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
201
201
  axios
202
202
  .post(urlToGetIpAddress, request, config)
203
203
  .then(function (response) {
204
- log.info("response ", response.data);
204
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("response ", response.data);
205
205
  if (response && response.data && response.data.status === true && response.data.ipAddress && response.data.ipAddress !== null) {
206
206
  _this.loadBalancerIpAddressForWebSocket = response.data.ipAddress;
207
207
  }
@@ -239,7 +239,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
239
239
  url = this.meetingStartRequest.wssUrl;
240
240
  }
241
241
  if (url) {
242
- log.info("Connecting to ", url);
242
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Connecting to ", url);
243
243
  this.isWebSocketConnectionInProgress = true;
244
244
  if ((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.isMobileApp) {
245
245
  this.wss = new WebSocket(url + this.connection);
@@ -249,7 +249,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
249
249
  }
250
250
  this.wss.onopen = function (event) {
251
251
  // this.checkIfSocketConnected();
252
- log.info("connected ----");
252
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("connected ----");
253
253
  _this.isWebSocketConnectionInProgress = false;
254
254
  _this.isSetUpDone = false;
255
255
  _this.socketCheckTimeout = undefined;
@@ -270,7 +270,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
270
270
  };
271
271
  this.wss.onclose = function (event) {
272
272
  _this.isWebSocketConnectionInProgress = false;
273
- log.info("WebSocket is closed now.");
273
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && ("WebSocket is closed now.");
274
274
  log.warn(event);
275
275
  _this.onWebSocketClosed(event);
276
276
  };
@@ -300,7 +300,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
300
300
  };
301
301
  WebsocketHandler.prototype.reconnectOnInternetFailur = function () {
302
302
  var _a;
303
- log.info("reconnectOnInternetFailur");
303
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("reconnectOnInternetFailur");
304
304
  if (this.wss) {
305
305
  (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnReconecting, {});
306
306
  this.wss.close(3005);
@@ -324,7 +324,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
324
324
  WebsocketHandler.prototype.onWebSocketClosed = function (event) {
325
325
  var _this = this;
326
326
  var _a;
327
- log.info("onWebSocketClosed", event.code);
327
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onWebSocketClosed", event.code);
328
328
  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"))) {
329
329
  this.socketCheckTimeout = window.setTimeout(function () {
330
330
  var _a;
@@ -338,7 +338,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
338
338
  };
339
339
  WebsocketHandler.prototype.tryToReconectSocket = function () {
340
340
  var _a, _b;
341
- log.info("tryToReconectSocket");
341
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("tryToReconectSocket");
342
342
  if (this.isWebScoketConnected() === false && this.isEnded === false) {
343
343
  this.wss = undefined;
344
344
  this.connection = ConnectionType.reconnect;
@@ -383,7 +383,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
383
383
  }
384
384
  var checkIfSetupDone = { to: this.meetingStartRequest.userId };
385
385
  this.sendSocketMessage(WebSocketBasicEvents.IsSetupDone, checkIfSetupDone);
386
- log.info("Vani setupDone asked");
386
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Vani setupDone asked");
387
387
  window.setTimeout(function () {
388
388
  if (_this.isSetUpDone) {
389
389
  return;
@@ -484,12 +484,12 @@ var WebsocketHandler = /** @class */ (function (_super) {
484
484
  return;
485
485
  }
486
486
  if (this.isSetUpDone === false) {
487
- log.info(data);
487
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
488
488
  this.isSetUpDone = true;
489
489
  if ((_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.isStartAndSetupWithServerCalled) {
490
490
  var isReconnect = data.message.isReconnection;
491
491
  if (isReconnect) {
492
- log.info("'onReconnect Meeting");
492
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("'onReconnect Meeting");
493
493
  (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.onReconnect();
494
494
  }
495
495
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",