vani-meeting-client 0.2.3 → 0.2.6

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.
@@ -47,6 +47,10 @@ export declare class CommunicationHandler {
47
47
  onVideoCallWebSocketMessage(websocketMessage: WebSocketMessageBody): Promise<void>;
48
48
  onReconnect(): Promise<void>;
49
49
  onStartMeeingCalled(): void;
50
+ onAudioBlocked(data: any): void;
51
+ onAudioUnblocked(data: any): void;
52
+ onVideoBlocked(data: any): void;
53
+ onVideoUnblocked(data: any): void;
50
54
  onIceCandidateDisconnected(): void;
51
55
  private checkIfInternetReachable;
52
56
  private onApiResponded;
@@ -304,6 +304,54 @@ var CommunicationHandler = /** @class */ (function () {
304
304
  }
305
305
  (_d = this.videoCallHandler) === null || _d === void 0 ? void 0 : _d.init();
306
306
  };
307
+ CommunicationHandler.prototype.onAudioBlocked = function (data) {
308
+ var _a, _b, _c;
309
+ log.info(data);
310
+ if (data.message.user) {
311
+ var participant = this.participantByUserId(data.message.user);
312
+ if (participant) {
313
+ participant.isAudioBlockedByAdmin = true;
314
+ if ((participant === null || participant === void 0 ? void 0 : participant.userId) === ((_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId)) {
315
+ (_b = this.meetingHandler) === null || _b === void 0 ? void 0 : _b.muteUser((_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId);
316
+ }
317
+ this.emitMessageToSource(VaniEvent.OnAudioBlocked, participant);
318
+ }
319
+ }
320
+ };
321
+ CommunicationHandler.prototype.onAudioUnblocked = function (data) {
322
+ log.info(data);
323
+ if (data.message.user) {
324
+ var participant = this.participantByUserId(data.message.user);
325
+ if (participant) {
326
+ participant.isAudioBlockedByAdmin = false;
327
+ this.emitMessageToSource(VaniEvent.OnAudioUnblocked, participant);
328
+ }
329
+ }
330
+ };
331
+ CommunicationHandler.prototype.onVideoBlocked = function (data) {
332
+ var _a, _b, _c;
333
+ log.info(data);
334
+ if (data.message.user) {
335
+ var participant = this.participantByUserId(data.message.user);
336
+ if (participant) {
337
+ participant.isVideoBlockedByAdmin = true;
338
+ if ((participant === null || participant === void 0 ? void 0 : participant.userId) === ((_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId)) {
339
+ (_b = this.meetingHandler) === null || _b === void 0 ? void 0 : _b.pauseCamera((_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId);
340
+ }
341
+ this.emitMessageToSource(VaniEvent.OnVideoBlocked, participant);
342
+ }
343
+ }
344
+ };
345
+ CommunicationHandler.prototype.onVideoUnblocked = function (data) {
346
+ log.info(data);
347
+ if (data.message.user) {
348
+ var participant = this.participantByUserId(data.message.user);
349
+ if (participant) {
350
+ participant.isVideoBlockedByAdmin = false;
351
+ this.emitMessageToSource(VaniEvent.OnVideoUnblocked, participant);
352
+ }
353
+ }
354
+ };
307
355
  //Connection Recheck
308
356
  CommunicationHandler.prototype.onIceCandidateDisconnected = function () {
309
357
  if (this.internetReachbilityTimeout) {
@@ -19,6 +19,10 @@ export declare enum VaniEvent {
19
19
  OnAllParticipants = "participants",
20
20
  OnParticipantDataUpdated = "onParticipantDataUpdated",
21
21
  OnAudioVideoStatusUpdated = "audioVideoStatusUpdated",
22
+ OnAudioBlocked = "onAudioBlocked",
23
+ OnVideoBlocked = "videoBlocked",
24
+ OnAudioUnblocked = "audioUnblocked",
25
+ OnVideoUnblocked = "videoUnblocked",
22
26
  OnNewChatMessageReceived = "onNewChatMessageReceived",
23
27
  OnOldMessages = "onOldMessages",
24
28
  OnSpeakerChanged = "onSpeakerChanged",
@@ -50,6 +54,10 @@ interface VaniConnectionEvents {
50
54
  [VaniEvent.OnNotReachable]: () => any;
51
55
  [VaniEvent.OnReconectionTimeout]: () => any;
52
56
  [VaniEvent.OnReconecting]: () => any;
57
+ [VaniEvent.OnVideoUnblocked]: (participant: Participant) => any;
58
+ [VaniEvent.OnAudioUnblocked]: (participant: Participant) => any;
59
+ [VaniEvent.OnVideoBlocked]: (participant: Participant) => any;
60
+ [VaniEvent.OnAudioBlocked]: (participant: Participant) => any;
53
61
  }
54
62
  export declare interface VaniEventListener {
55
63
  on<U extends keyof VaniConnectionEvents>(event: U, listener: VaniConnectionEvents[U]): this;
@@ -17,6 +17,10 @@ export var VaniEvent;
17
17
  VaniEvent["OnAllParticipants"] = "participants";
18
18
  VaniEvent["OnParticipantDataUpdated"] = "onParticipantDataUpdated";
19
19
  VaniEvent["OnAudioVideoStatusUpdated"] = "audioVideoStatusUpdated";
20
+ VaniEvent["OnAudioBlocked"] = "onAudioBlocked";
21
+ VaniEvent["OnVideoBlocked"] = "videoBlocked";
22
+ VaniEvent["OnAudioUnblocked"] = "audioUnblocked";
23
+ VaniEvent["OnVideoUnblocked"] = "videoUnblocked";
20
24
  VaniEvent["OnNewChatMessageReceived"] = "onNewChatMessageReceived";
21
25
  VaniEvent["OnOldMessages"] = "onOldMessages";
22
26
  VaniEvent["OnSpeakerChanged"] = "onSpeakerChanged";
@@ -348,7 +348,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
348
348
  }, 200);
349
349
  };
350
350
  WebsocketHandler.prototype.onMessage = function (message) {
351
- var _a, _b, _c, _d, _e, _f, _g, _h;
351
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
352
352
  this.lastPingTimeStamp = new Date().getTime();
353
353
  var messagejson = JSON.parse(message);
354
354
  if (messagejson.type && messagejson.data) {
@@ -395,6 +395,18 @@ var WebsocketHandler = /** @class */ (function (_super) {
395
395
  else if (type === WebSocketBasicEvents.OnAudioVideoStatusUpdated) {
396
396
  (_h = this.communicationHandler) === null || _h === void 0 ? void 0 : _h.onAudioVideoStatusUpdated(data);
397
397
  }
398
+ else if (type === WebSocketBasicEvents.OnAudioBlockRequest) {
399
+ (_j = this.communicationHandler) === null || _j === void 0 ? void 0 : _j.onAudioBlocked(data);
400
+ }
401
+ else if (type === WebSocketBasicEvents.OnAudioUnblockRequest) {
402
+ (_k = this.communicationHandler) === null || _k === void 0 ? void 0 : _k.onAudioUnblocked(data);
403
+ }
404
+ else if (type === WebSocketBasicEvents.OnVideoBlockRequest) {
405
+ (_l = this.communicationHandler) === null || _l === void 0 ? void 0 : _l.onVideoBlocked(data);
406
+ }
407
+ else if (type === WebSocketBasicEvents.OnVideoUnblockRequest) {
408
+ (_m = this.communicationHandler) === null || _m === void 0 ? void 0 : _m.onVideoUnblocked(data);
409
+ }
398
410
  }
399
411
  };
400
412
  WebsocketHandler.prototype.onSetupDone = function (data) {
@@ -426,7 +438,6 @@ var WebsocketHandler = /** @class */ (function (_super) {
426
438
  WebsocketHandler.prototype.checkIfPingIsRunning = function () {
427
439
  var _this = this;
428
440
  var _a, _b;
429
- console.log("checkIfPingIsRunning");
430
441
  if (this.isWebScoketConnected()) {
431
442
  if ((this.lastPingTimeStamp + (40 * 1000)) < new Date().getTime()) {
432
443
  this.pingCheckTimeout = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "0.2.3",
3
+ "version": "0.2.6",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",