vani-meeting-client 2.2.2 → 2.2.3-beta1

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.
@@ -15,6 +15,7 @@ export declare class MeetingHandler {
15
15
  meetingStartRequestObject(roomId: string, userId: string, appId: string, wssUrl: string, shouldIgnoreCaseForRoomId?: boolean): MeetingStartRequest;
16
16
  endAndDestory(): void;
17
17
  cleanupWebsocket: () => void;
18
+ isWebSocketInPreConnect: () => boolean;
18
19
  requestToCloseTheRoom: () => void;
19
20
  preconnect: (url: string) => Promise<void>;
20
21
  init(): Promise<boolean>;
@@ -55,6 +55,13 @@ var MeetingHandler = /** @class */ (function () {
55
55
  catch (err) {
56
56
  }
57
57
  };
58
+ this.isWebSocketInPreConnect = function () {
59
+ var _a;
60
+ if (_this.websocketCallHandler) {
61
+ return (_a = _this.websocketCallHandler) === null || _a === void 0 ? void 0 : _a.isWebSocketInPreConnect();
62
+ }
63
+ return false;
64
+ };
58
65
  this.requestToCloseTheRoom = function () {
59
66
  var _a;
60
67
  (_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.requestToCloseTheRoom();
@@ -476,7 +483,6 @@ var MeetingHandler = /** @class */ (function () {
476
483
  MeetingHandler.prototype.checkSocket = function () {
477
484
  return __awaiter(this, void 0, void 0, function () {
478
485
  return __generator(this, function (_a) {
479
- debugger;
480
486
  if (!this.meetingStartRequest) {
481
487
  log.error("meetingStartRequestObject not found");
482
488
  return [2 /*return*/, false];
@@ -13,6 +13,7 @@ export declare class Participant {
13
13
  isAudioEnable: boolean;
14
14
  isStartMeetingCalled: boolean;
15
15
  isRecordingUser: boolean;
16
- peerConnections: Map<string, PeerConnection>;
16
+ private peerConnections;
17
+ getPeerConnections: () => Map<string, PeerConnection>;
17
18
  constructor(_userId: string, _roomId: string, _userData?: any, _isAdmin?: boolean);
18
19
  }
@@ -2,6 +2,7 @@ var Participant = /** @class */ (function () {
2
2
  function Participant(_userId, _roomId, _userData, _isAdmin) {
3
3
  if (_userData === void 0) { _userData = {}; }
4
4
  if (_isAdmin === void 0) { _isAdmin = false; }
5
+ var _this = this;
5
6
  this.isAdmin = false;
6
7
  this.isAudioBlockedByAdmin = false;
7
8
  this.isVideoBlockedByAdmin = false;
@@ -13,6 +14,12 @@ var Participant = /** @class */ (function () {
13
14
  this.isStartMeetingCalled = false;
14
15
  this.isRecordingUser = false;
15
16
  this.peerConnections = new Map();
17
+ this.getPeerConnections = function () {
18
+ if (!_this.peerConnections) {
19
+ _this.peerConnections = new Map();
20
+ }
21
+ return _this.peerConnections;
22
+ };
16
23
  this.userId = _userId;
17
24
  this.roomId = _roomId;
18
25
  this.userData = _userData;
@@ -69,16 +69,17 @@ var WebrtcHandler = /** @class */ (function (_super) {
69
69
  return _this;
70
70
  }
71
71
  WebrtcHandler.prototype.onParticipantUpdated = function () {
72
- throw new Error("Method not implemented.");
72
+ console.log("onParticipantUpdated");
73
+ // throw new Error("Method not implemented.");
73
74
  };
74
75
  WebrtcHandler.prototype.resumeIncomingTrack = function (track) {
75
- throw new Error("Method not implemented.");
76
+ // throw new Error("Method not implemented.");
76
77
  };
77
78
  WebrtcHandler.prototype.pauseIncomingTrack = function (track) {
78
- throw new Error("Method not implemented.");
79
+ // throw new Error("Method not implemented.");
79
80
  };
80
81
  WebrtcHandler.prototype.onSocketMessage = function (websocketCallHandler) {
81
- throw new Error("Method not implemented.");
82
+ // throw new Error("Method not implemented.");
82
83
  };
83
84
  WebrtcHandler.prototype.onAllParticipants = function (participants) {
84
85
  return __awaiter(this, void 0, void 0, function () {
@@ -98,13 +99,16 @@ var WebrtcHandler = /** @class */ (function (_super) {
98
99
  switch (_a.label) {
99
100
  case 0:
100
101
  selfParticpant = this.communicationHandler.getSelfParticipant();
101
- if (!(selfParticpant.userId !== participant.userId && !selfParticpant.peerConnections.has(participant.userId))) return [3 /*break*/, 2];
102
+ console.log(selfParticpant);
103
+ debugger;
104
+ if (!(selfParticpant.userId !== participant.userId && !selfParticpant.getPeerConnections().has(participant.userId))) return [3 /*break*/, 2];
105
+ console.log("onUserJoined ", participant);
102
106
  isOfferInitParticipant = this.isOfferInitParticipant(participant);
103
107
  if (!!isOfferInitParticipant) return [3 /*break*/, 2];
104
- if (!selfParticpant.peerConnections.has(participant.userId)) {
105
- selfParticpant.peerConnections.set(participant.userId, new PeerConnection());
108
+ if (!selfParticpant.getPeerConnections().has(participant.userId)) {
109
+ selfParticpant.getPeerConnections().set(participant.userId, new PeerConnection());
106
110
  }
107
- peerConnectionObject = selfParticpant.peerConnections.get(participant.userId);
111
+ peerConnectionObject = selfParticpant.getPeerConnections().get(participant.userId);
108
112
  peerConnection = this.dynamicLibHelper.getRTCPeerConnection(this.meetingStartRequest);
109
113
  if (!peerConnection) return [3 /*break*/, 2];
110
114
  peerConnection.addTransceiver("audio", { direction: "sendrecv" });
@@ -92,10 +92,12 @@ export declare class WebsocketHandler extends Base {
92
92
  private setUpTry;
93
93
  private pongData;
94
94
  private lastPingTimeStamp;
95
+ private isNormalConnectionCalledWhileInPreconnectProcess;
95
96
  protected onObjectCreated(): void;
96
97
  cleanup(): Promise<void>;
97
98
  startSocketConnection(isForPreConnect?: boolean, url?: string): Promise<void>;
98
99
  private connect;
100
+ isWebSocketInPreConnect(): boolean;
99
101
  isWebScoketConnectedWithoutSetup(): boolean;
100
102
  isWebScoketConnected(): boolean;
101
103
  sendSocketMessage(type: WebSocketEvents, data: any): void;
@@ -147,6 +147,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
147
147
  _this.setUpTry = 0;
148
148
  _this.pongData = undefined;
149
149
  _this.lastPingTimeStamp = 0;
150
+ _this.isNormalConnectionCalledWhileInPreconnectProcess = false;
150
151
  _this.onCloseTheRoomForcefully = function (data) { return __awaiter(_this, void 0, void 0, function () {
151
152
  var _a, _b;
152
153
  return __generator(this, function (_c) {
@@ -177,6 +178,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
177
178
  }
178
179
  catch (err) {
179
180
  }
181
+ this.isNormalConnectionCalledWhileInPreconnectProcess = false;
180
182
  this.loadBalancerIpAddressForWebSocket = undefined;
181
183
  this.isEnded = true;
182
184
  if (this.wss) {
@@ -248,6 +250,9 @@ var WebsocketHandler = /** @class */ (function (_super) {
248
250
  var _this = this;
249
251
  return __generator(this, function (_d) {
250
252
  if (this.isEnded === true || this.isWebSocketConnectionInProgress) {
253
+ if (!isForPreConnect) {
254
+ this.isNormalConnectionCalledWhileInPreconnectProcess = true;
255
+ }
251
256
  return [2 /*return*/];
252
257
  }
253
258
  if (!this.wss || (isForceFully && this.isWebScoketConnectedWithoutSetup() === false)) {
@@ -273,7 +278,6 @@ var WebsocketHandler = /** @class */ (function (_super) {
273
278
  if (!url_1.includes("connection=")) {
274
279
  url_1 = url_1 + "/?connection=";
275
280
  }
276
- debugger;
277
281
  if (url_1) {
278
282
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Connecting to ", url_1);
279
283
  this.isWebSocketConnectionInProgress = true;
@@ -290,9 +294,13 @@ var WebsocketHandler = /** @class */ (function (_super) {
290
294
  _this.isSetUpDone = false;
291
295
  _this.websocketConnectionUrl = url_1;
292
296
  _this.socketCheckTimeout = undefined;
293
- if (!isForPreConnect) {
297
+ if (!isForPreConnect || _this.isNormalConnectionCalledWhileInPreconnectProcess) {
294
298
  _this.onSocketConnected();
295
299
  }
300
+ else {
301
+ console.log("WebSocket connected in pre connect");
302
+ }
303
+ _this.isNormalConnectionCalledWhileInPreconnectProcess = false;
296
304
  };
297
305
  this.wss.onmessage = function (event) {
298
306
  _this.isWebSocketConnectionInProgress = false;
@@ -313,7 +321,6 @@ var WebsocketHandler = /** @class */ (function (_super) {
313
321
  }
314
322
  };
315
323
  this.wss.onclose = function (event) {
316
- debugger;
317
324
  _this.isSetUpDone = false;
318
325
  _this.isWebSocketConnectionInProgress = false;
319
326
  _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && ("WebSocket is closed now.");
@@ -332,6 +339,12 @@ var WebsocketHandler = /** @class */ (function (_super) {
332
339
  });
333
340
  });
334
341
  };
342
+ WebsocketHandler.prototype.isWebSocketInPreConnect = function () {
343
+ if (this.wss && this.wss.readyState === 1 && !this.isSetUpDone) {
344
+ return true;
345
+ }
346
+ return false;
347
+ };
335
348
  WebsocketHandler.prototype.isWebScoketConnectedWithoutSetup = function () {
336
349
  var _a;
337
350
  if (this.wss && this.wss.readyState === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "2.2.2",
3
+ "version": "2.2.3beta1",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/lib/.DS_Store DELETED
Binary file