vani-meeting-client 1.8.2 → 1.8.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.
@@ -1,4 +1,5 @@
1
1
  import { MeetingStartRequest, VaniEventListener, Device, MessagePayload } from ".";
2
+ import { BaseVideoCallHandler } from "./video-call-handler/BaseVideoCallHandler";
2
3
  import { GetDevicesType } from "./user-media-handler/UserMediaHandler";
3
4
  import { Track, TrackKind } from "./model/Track";
4
5
  import { TaskResponse } from "./model/TaskResponse";
@@ -14,6 +15,7 @@ export declare class MeetingHandler {
14
15
  endAndDestory(): void;
15
16
  requestToCloseTheRoom: () => void;
16
17
  init(): Promise<void>;
18
+ recreateVideoCallHandler: () => Promise<BaseVideoCallHandler | undefined>;
17
19
  switchCamera(): void;
18
20
  startLocalStream(isVideoRequired: boolean, isAudioRequired: boolean, shouldAddTrackImmediately?: boolean, userMediaPayload?: any): Promise<void>;
19
21
  startScreenShare(isAudioRequired?: boolean, shouldAddTrackImmediately?: boolean, screensharePayload?: any): Promise<void>;
@@ -50,6 +52,7 @@ export declare class MeetingHandler {
50
52
  getEventEmitter(): VaniEventListener | undefined;
51
53
  restartTransport: () => Promise<void>;
52
54
  private emitMessageToSource;
55
+ restartSFU: () => Promise<void>;
53
56
  private cleanup;
54
57
  private handleGA;
55
58
  }
@@ -50,6 +50,25 @@ var MeetingHandler = /** @class */ (function () {
50
50
  var _a;
51
51
  (_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.requestToCloseTheRoom();
52
52
  };
53
+ this.recreateVideoCallHandler = function () { return __awaiter(_this, void 0, void 0, function () {
54
+ var _a;
55
+ var _b;
56
+ return __generator(this, function (_c) {
57
+ switch (_c.label) {
58
+ case 0:
59
+ if (!this.meetingStartRequest) {
60
+ log.error("meetingStartRequestObject not found");
61
+ return [2 /*return*/];
62
+ }
63
+ this.videoCallHandler = undefined;
64
+ _a = this;
65
+ return [4 /*yield*/, new DynamicLibHelper().getVideoCallClassHandler((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.meetingType, this.meetingStartRequest, this.communicationHandler)];
66
+ case 1:
67
+ _a.videoCallHandler = _c.sent();
68
+ return [2 /*return*/, this.videoCallHandler];
69
+ }
70
+ });
71
+ }); };
53
72
  this.restartTransport = function () { return __awaiter(_this, void 0, void 0, function () {
54
73
  var _a;
55
74
  return __generator(this, function (_b) {
@@ -57,6 +76,17 @@ var MeetingHandler = /** @class */ (function () {
57
76
  return [2 /*return*/];
58
77
  });
59
78
  }); };
79
+ this.restartSFU = function () { return __awaiter(_this, void 0, void 0, function () {
80
+ var _a;
81
+ return __generator(this, function (_b) {
82
+ switch (_b.label) {
83
+ case 0: return [4 /*yield*/, ((_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.restartSFU())];
84
+ case 1:
85
+ _b.sent();
86
+ return [2 /*return*/];
87
+ }
88
+ });
89
+ }); };
60
90
  }
61
91
  MeetingHandler.prototype.meetingStartRequestObject = function (roomId, userId, appId, wssUrl) {
62
92
  if (!this.meetingStartRequest) {
@@ -311,12 +341,15 @@ var MeetingHandler = /** @class */ (function () {
311
341
  return undefined;
312
342
  };
313
343
  MeetingHandler.prototype.updateParticipantData = function (participant) {
314
- var _a;
344
+ var _a, _b;
345
+ if (this.meetingStartRequest && participant.userId === ((_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId)) {
346
+ this.meetingStartRequest.userData = participant.userData;
347
+ }
315
348
  var oldParticipant = this.participantByUserId(participant.userId);
316
349
  if (oldParticipant) {
317
350
  oldParticipant = Object.assign(oldParticipant, participant);
318
351
  this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("updateParticipantData", oldParticipant);
319
- (_a = this.websocketCallHandler) === null || _a === void 0 ? void 0 : _a.sendSocketMessage(WebSocketBasicEvents.UpdateParticipant, oldParticipant);
352
+ (_b = this.websocketCallHandler) === null || _b === void 0 ? void 0 : _b.sendSocketMessage(WebSocketBasicEvents.UpdateParticipant, oldParticipant);
320
353
  }
321
354
  return oldParticipant;
322
355
  };
@@ -61,5 +61,7 @@ export declare class CommunicationHandler {
61
61
  onIceCandidateDisconnected(): void;
62
62
  checkIfInternetReachable: (count: number) => void;
63
63
  private onApiResponded;
64
+ restartSFU: () => Promise<void>;
65
+ private reloadSFUCleanUpDone;
64
66
  cleanup(): void;
65
67
  }
@@ -38,7 +38,7 @@ import { VaniEvent, MessagePayload, LogLevel } from "..";
38
38
  import { Participant } from "../model/Participant";
39
39
  import * as log from 'loglevel';
40
40
  import { Track, TrackKind } from "../model/Track";
41
- import { WebSocketBasicEvents } from "../websocket-handler/WebsocketHandler";
41
+ import { SFUMessageType, WebSocketBasicEvents } from "../websocket-handler/WebsocketHandler";
42
42
  import { VaniEventListener } from "../utility/VaniEventListener";
43
43
  import { Utility } from "../utility/Utility";
44
44
  var CommunicationHandler = /** @class */ (function () {
@@ -104,6 +104,35 @@ var CommunicationHandler = /** @class */ (function () {
104
104
  });
105
105
  ;
106
106
  };
107
+ this.restartSFU = function () { return __awaiter(_this, void 0, void 0, function () {
108
+ var messageJson;
109
+ var _a;
110
+ return __generator(this, function (_b) {
111
+ (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.cleanup();
112
+ messageJson = { to: "self", type: SFUMessageType.ReloadSFU, message: SFUMessageType.ReloadSFU };
113
+ this.sendWebSocketMessage(SFUMessageType.SFUMessage, messageJson);
114
+ return [2 /*return*/];
115
+ });
116
+ }); };
117
+ this.reloadSFUCleanUpDone = function () { return __awaiter(_this, void 0, void 0, function () {
118
+ var videoCallHandler;
119
+ var _a;
120
+ return __generator(this, function (_b) {
121
+ switch (_b.label) {
122
+ case 0:
123
+ this.videoCallHandler = undefined;
124
+ this.allTracks = this.allTracks.filter(function (eachTrack) { return eachTrack.isLocalTrack === true; });
125
+ return [4 /*yield*/, ((_a = this.meetingHandler) === null || _a === void 0 ? void 0 : _a.recreateVideoCallHandler())];
126
+ case 1:
127
+ videoCallHandler = _b.sent();
128
+ if (videoCallHandler) {
129
+ this.setVideoCallHandler(videoCallHandler);
130
+ videoCallHandler.init();
131
+ }
132
+ return [2 /*return*/];
133
+ }
134
+ });
135
+ }); };
107
136
  this.meetingHandler = meetingHandler;
108
137
  this.eventEmitter.setMaxListeners(100000);
109
138
  }
@@ -151,6 +180,7 @@ var CommunicationHandler = /** @class */ (function () {
151
180
  participant.isVideoBlockedByAdmin = this.meetingStartRequest.defaultVideoBlocked;
152
181
  participant.isScreenshareBlockedByAdmin = this.meetingStartRequest.defaultScreenShareBlocked;
153
182
  participant.isRecordingUser = this.meetingStartRequest.isRecordingUser;
183
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("addParticipantIfNotExist from getSelfParticipant", participant);
154
184
  this.addParticipantIfNotExist(participant);
155
185
  }
156
186
  return participant;
@@ -170,6 +200,7 @@ var CommunicationHandler = /** @class */ (function () {
170
200
  Object.entries(data.message).forEach(function (_a) {
171
201
  var userId = _a[0], participant = _a[1];
172
202
  userIds = userIds + " " + userId;
203
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("addParticipantIfNotExist from onServerParticipants", data);
173
204
  _this.addParticipantIfNotExist(participant, false);
174
205
  });
175
206
  // const allParticiapntsToBeRemove = this.allParticipants.filter(participant => (userIds.includes(participant.userId) === false))
@@ -407,7 +438,12 @@ var CommunicationHandler = /** @class */ (function () {
407
438
  var _a;
408
439
  return __awaiter(this, void 0, void 0, function () {
409
440
  return __generator(this, function (_b) {
410
- (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.onSocketMessage(websocketMessage);
441
+ if (websocketMessage.type === SFUMessageType.ReloadSFUCleanUpDone) {
442
+ this.reloadSFUCleanUpDone();
443
+ }
444
+ else {
445
+ (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.onSocketMessage(websocketMessage);
446
+ }
411
447
  return [2 /*return*/];
412
448
  });
413
449
  });
@@ -41,12 +41,10 @@ var DynamicLibHelper = /** @class */ (function () {
41
41
  }
42
42
  DynamicLibHelper.prototype.getReactNativeWebrtcPlugin = function (meetingStartRequest) {
43
43
  return __awaiter(this, void 0, void 0, function () {
44
- var libName;
45
44
  return __generator(this, function (_a) {
46
45
  try {
47
46
  if (meetingStartRequest.isMobileApp) {
48
- libName = 'react-native-webrtc';
49
- return [2 /*return*/, (require(libName))];
47
+ return [2 /*return*/, require("react-native-webrtc")];
50
48
  }
51
49
  }
52
50
  catch (_b) {
@@ -726,6 +726,7 @@ var SFUHandler = /** @class */ (function (_super) {
726
726
  _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(data);
727
727
  var participant = (_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.participantByUserId(data.participant.userId);
728
728
  if (!participant) {
729
+ _this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("addParticipantIfNotExist from onServerConsumer", data.participant);
729
730
  participant = (_b = _this.communicationHandler) === null || _b === void 0 ? void 0 : _b.addParticipantIfNotExist(data.participant, true);
730
731
  }
731
732
  if (participant) {
@@ -33,6 +33,8 @@ export declare enum WebSocketBasicEvents {
33
33
  export declare enum SFUMessageType {
34
34
  SFUMessage = "sfuMessage",
35
35
  GetRouterRtpCapabilities = "routerRtpCapabilities",
36
+ ReloadSFUCleanUpDone = "ReloadSFUCleanUpDone",
37
+ ReloadSFU = "reloadSFU",
36
38
  OnRouterRtpCapabilities = "onRouterRtpCapabilities",
37
39
  OnTransportConnect = "transportConnect",
38
40
  OnCreateTransports = "createTransports",
@@ -89,6 +89,8 @@ export var SFUMessageType;
89
89
  (function (SFUMessageType) {
90
90
  SFUMessageType["SFUMessage"] = "sfuMessage";
91
91
  SFUMessageType["GetRouterRtpCapabilities"] = "routerRtpCapabilities";
92
+ SFUMessageType["ReloadSFUCleanUpDone"] = "ReloadSFUCleanUpDone";
93
+ SFUMessageType["ReloadSFU"] = "reloadSFU";
92
94
  SFUMessageType["OnRouterRtpCapabilities"] = "onRouterRtpCapabilities";
93
95
  SFUMessageType["OnTransportConnect"] = "transportConnect";
94
96
  SFUMessageType["OnCreateTransports"] = "createTransports";
@@ -439,6 +441,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
439
441
  }
440
442
  else if (type === WebSocketBasicEvents.OnParticipantUpdated) {
441
443
  if (data) {
444
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("WebSocketBasicEvents.OnParticipantUpdated", data.message);
442
445
  (_e = this.communicationHandler) === null || _e === void 0 ? void 0 : _e.addParticipantIfNotExist(data.message, true);
443
446
  }
444
447
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "analytics": "^0.7.21",
47
47
  "axios": "^0.24.0",
48
48
  "loglevel": "^1.8.0",
49
- "mediasoup-client": "^3.7.16"
49
+ "mediasoup-client": "^3.81.1"
50
50
  },
51
51
  "optionalDependencies": {}
52
52
  }