vani-meeting-client 1.2.7 → 1.2.9

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.
@@ -30,6 +30,7 @@ export declare class MeetingHandler {
30
30
  resumeIncomingTrack(track: Track): void;
31
31
  updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
32
32
  resumeProducerOrConsumerForTrack(track: Track): Promise<void>;
33
+ getConsumerForTrack(track: Track): void | undefined;
33
34
  participantByUserId(userId: string): Participant | undefined;
34
35
  updateParticipantData(participant: Participant): Participant | undefined;
35
36
  getUpdatedParticipantsListFromServer(): void;
@@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13
13
  function verb(n) { return function (v) { return step([n, v]); }; }
14
14
  function step(op) {
15
15
  if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
17
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
18
  if (y = 0, t) op = [op[0] & 2, t.value];
19
19
  switch (op[0]) {
@@ -274,6 +274,10 @@ var MeetingHandler = /** @class */ (function () {
274
274
  });
275
275
  });
276
276
  };
277
+ MeetingHandler.prototype.getConsumerForTrack = function (track) {
278
+ var _a;
279
+ return (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getConsumerForTrack(track);
280
+ };
277
281
  //Participant
278
282
  MeetingHandler.prototype.participantByUserId = function (userId) {
279
283
  var _a, _b, _c;
@@ -41,6 +41,7 @@ export declare class CommunicationHandler {
41
41
  getAllTracksForParticipant(participant: Participant): Track[];
42
42
  removeTrack(track: Track, shouldInfromVideoController?: boolean): void;
43
43
  resumeProducerOrConsumerForTrack(track: Track): void;
44
+ getConsumerForTrack(track: Track): void | undefined;
44
45
  addUpdateRemoteTrack(track: Track, participant: Participant, shouldInfromIfNotExist?: boolean): Track;
45
46
  addUpdateLocalTrack(track: Track): void;
46
47
  onOldMessages(data: any): void;
@@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13
13
  function verb(n) { return function (v) { return step([n, v]); }; }
14
14
  function step(op) {
15
15
  if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
17
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
18
  if (y = 0, t) op = [op[0] & 2, t.value];
19
19
  switch (op[0]) {
@@ -272,6 +272,10 @@ var CommunicationHandler = /** @class */ (function () {
272
272
  var _a;
273
273
  (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.resumeProducerOrConsumerForTrack(track);
274
274
  };
275
+ CommunicationHandler.prototype.getConsumerForTrack = function (track) {
276
+ var _a;
277
+ return (_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.getConsumerForTrack(track);
278
+ };
275
279
  CommunicationHandler.prototype.addUpdateRemoteTrack = function (track, participant, shouldInfromIfNotExist) {
276
280
  if (shouldInfromIfNotExist === void 0) { shouldInfromIfNotExist = false; }
277
281
  var oldTrack = this.getTrackById(track.trackId);
@@ -27,6 +27,7 @@ export declare enum VaniEvent {
27
27
  OnNewChatMessageReceived = "onNewChatMessageReceived",
28
28
  OnOldMessages = "onOldMessages",
29
29
  OnSpeakerChanged = "onSpeakerChanged",
30
+ OnAudioVolumeChanged = "OnAudioVolumeChanged",
30
31
  OnNotReachable = "notReachable",
31
32
  OnReconectionTimeout = "reconectionTimeout",
32
33
  OnReconecting = "reconecting",
@@ -53,6 +54,10 @@ interface VaniConnectionEvents {
53
54
  [VaniEvent.OnOldMessages]: (messages: MessagePayload[]) => any;
54
55
  [VaniEvent.OnNewChatMessageReceived]: (message: MessagePayload) => any;
55
56
  [VaniEvent.OnSpeakerChanged]: (participant: Participant) => any;
57
+ [VaniEvent.OnAudioVolumeChanged]: (data: {
58
+ participant: Participant;
59
+ volume: any;
60
+ }) => any;
56
61
  [VaniEvent.OnNotReachable]: () => any;
57
62
  [VaniEvent.OnReconectionTimeout]: () => any;
58
63
  [VaniEvent.OnReconecting]: () => any;
@@ -25,6 +25,7 @@ export var VaniEvent;
25
25
  VaniEvent["OnNewChatMessageReceived"] = "onNewChatMessageReceived";
26
26
  VaniEvent["OnOldMessages"] = "onOldMessages";
27
27
  VaniEvent["OnSpeakerChanged"] = "onSpeakerChanged";
28
+ VaniEvent["OnAudioVolumeChanged"] = "OnAudioVolumeChanged";
28
29
  VaniEvent["OnNotReachable"] = "notReachable";
29
30
  VaniEvent["OnReconectionTimeout"] = "reconectionTimeout";
30
31
  VaniEvent["OnReconecting"] = "reconecting";
@@ -28,7 +28,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
28
28
  function verb(n) { return function (v) { return step([n, v]); }; }
29
29
  function step(op) {
30
30
  if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
32
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
33
  if (y = 0, t) op = [op[0] & 2, t.value];
34
34
  switch (op[0]) {
@@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13
13
  function verb(n) { return function (v) { return step([n, v]); }; }
14
14
  function step(op) {
15
15
  if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
17
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
18
  if (y = 0, t) op = [op[0] & 2, t.value];
19
19
  switch (op[0]) {
@@ -15,6 +15,7 @@ export declare abstract class BaseVideoCallHandler extends Base {
15
15
  abstract onParticipantUpdated(): void;
16
16
  abstract createDataChannel(): any;
17
17
  abstract sendMessageViaDataChannel(messagePayload: any): any;
18
+ getConsumerForTrack(track: Track): void;
18
19
  resumeProducerOrConsumerForTrack(track: Track): Promise<void>;
19
20
  reconnectedWithoutPing(): void;
20
21
  updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
@@ -28,7 +28,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
28
28
  function verb(n) { return function (v) { return step([n, v]); }; }
29
29
  function step(op) {
30
30
  if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
32
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
33
  if (y = 0, t) op = [op[0] & 2, t.value];
34
34
  switch (op[0]) {
@@ -61,6 +61,8 @@ var BaseVideoCallHandler = /** @class */ (function (_super) {
61
61
  _super.prototype.onObjectCreated.call(this);
62
62
  (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.setVideoCallHandler(this);
63
63
  };
64
+ BaseVideoCallHandler.prototype.getConsumerForTrack = function (track) {
65
+ };
64
66
  BaseVideoCallHandler.prototype.resumeProducerOrConsumerForTrack = function (track) {
65
67
  return __awaiter(this, void 0, void 0, function () {
66
68
  return __generator(this, function (_a) {
@@ -1,6 +1,7 @@
1
1
  import { BaseVideoCallHandler } from "./BaseVideoCallHandler";
2
2
  import { WebSocketMessageBody } from "../websocket-handler/WebsocketHandler";
3
3
  import { Track } from "../model/Track";
4
+ import { Consumer } from "mediasoup-client/lib/Consumer";
4
5
  import { MeetingStartRequest } from '..';
5
6
  import { CommunicationHandler } from '../inter-communication-handler/CommunicationHandler';
6
7
  export declare class SFUHandler extends BaseVideoCallHandler {
@@ -20,6 +21,7 @@ export declare class SFUHandler extends BaseVideoCallHandler {
20
21
  private onRestartIceCandidateResponse;
21
22
  stopTrack(track: Track): void;
22
23
  pauseTrack(track: Track): void;
24
+ getConsumerForTrack(track: Track): Consumer | undefined;
23
25
  resumeProducerOrConsumerForTrack(track: Track): Promise<void>;
24
26
  resumeTrack(track: Track): void;
25
27
  pauseIncomingTrack(track: Track): void;
@@ -45,6 +47,7 @@ export declare class SFUHandler extends BaseVideoCallHandler {
45
47
  private onTrackEnded;
46
48
  private onNewProducer;
47
49
  private onServerConsumer;
50
+ private onAudioVolumeChanged;
48
51
  private onSpeakerChanged;
49
52
  cleanup(): void;
50
53
  }
@@ -39,7 +39,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
39
39
  function verb(n) { return function (v) { return step([n, v]); }; }
40
40
  function step(op) {
41
41
  if (f) throw new TypeError("Generator is already executing.");
42
- while (_) try {
42
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
43
43
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
44
44
  if (y = 0, t) op = [op[0] & 2, t.value];
45
45
  switch (op[0]) {
@@ -169,6 +169,10 @@ var SFUHandler = /** @class */ (function (_super) {
169
169
  }
170
170
  }
171
171
  };
172
+ SFUHandler.prototype.getConsumerForTrack = function (track) {
173
+ var consumer = this.consumers.find(function (consumer) { return consumer.appData.producerData.trackId === track.trackId; });
174
+ return consumer;
175
+ };
172
176
  SFUHandler.prototype.resumeProducerOrConsumerForTrack = function (track) {
173
177
  return __awaiter(this, void 0, void 0, function () {
174
178
  var producer, consumer;
@@ -372,11 +376,11 @@ var SFUHandler = /** @class */ (function (_super) {
372
376
  var _this = this;
373
377
  return __generator(this, function (_a) {
374
378
  this.device.observer.on("newtransport", function (transport) {
375
- transport.on("connect", function (transportLocalParameters, _callback, errback) { return __awaiter(_this, void 0, void 0, function () {
379
+ transport.on("connect", function (dtlsParameters, _callback, errback) { return __awaiter(_this, void 0, void 0, function () {
376
380
  var messageJson;
377
381
  return __generator(this, function (_a) {
378
382
  this.transportCallBacks[transport.id] = _callback;
379
- messageJson = { to: "self", type: SFUMessageType.OnTransportConnect, message: { type: transport.appData.type, transportId: transport.id, dtlsParameters: transportLocalParameters.dtlsParameters } };
383
+ messageJson = { to: "self", type: SFUMessageType.OnTransportConnect, message: { type: transport.appData.type, transportId: transport.id, dtlsParameters: dtlsParameters } };
380
384
  this.sendSFUMessageToSocket(messageJson);
381
385
  return [2 /*return*/];
382
386
  });
@@ -544,6 +548,9 @@ var SFUHandler = /** @class */ (function (_super) {
544
548
  else if (websocketCallHandler.type === SFUMessageType.OnSpeakerChanged) {
545
549
  this.onSpeakerChanged(websocketCallHandler.data);
546
550
  }
551
+ else if (websocketCallHandler.type === SFUMessageType.OnAudioVolumeChanged) {
552
+ this.onAudioVolumeChanged(websocketCallHandler.data);
553
+ }
547
554
  else if (websocketCallHandler.type === SFUMessageType.OnTrackEnded) {
548
555
  this.onTrackEnded(websocketCallHandler.data);
549
556
  }
@@ -613,7 +620,7 @@ var SFUHandler = /** @class */ (function (_super) {
613
620
  consumerObj = data.message.consumer;
614
621
  this.consumerTransport.consumeData(consumerObj).then(function (consumer) {
615
622
  _this.dataConsumer.push(consumer);
616
- consumer.on("message", function (message, ppid) {
623
+ consumer.on("message", function (message) {
617
624
  var _a;
618
625
  message = JSON.parse(message);
619
626
  if (message && message.message) {
@@ -651,6 +658,16 @@ var SFUHandler = /** @class */ (function (_super) {
651
658
  });
652
659
  });
653
660
  };
661
+ SFUHandler.prototype.onAudioVolumeChanged = function (data) {
662
+ var _a, _b;
663
+ if (data && data.message && data.message.userId) {
664
+ var speakerId = data.message.userId;
665
+ var participant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.participantByUserId(speakerId);
666
+ if (participant) {
667
+ (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.emitMessageToSource(VaniEvent.OnAudioVolumeChanged, { participant: participant, volume: data.message.volume });
668
+ }
669
+ }
670
+ };
654
671
  SFUHandler.prototype.onSpeakerChanged = function (data) {
655
672
  var _a, _b;
656
673
  if (data && data.message && data.message.speakerUserId) {
@@ -28,7 +28,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
28
28
  function verb(n) { return function (v) { return step([n, v]); }; }
29
29
  function step(op) {
30
30
  if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
32
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
33
  if (y = 0, t) op = [op[0] & 2, t.value];
34
34
  switch (op[0]) {
@@ -58,9 +58,10 @@ export declare enum SFUMessageType {
58
58
  OnRestartIceCandidateResponse = "onRestartIceCandidate",
59
59
  OnTransportNotFound = "onTransportNotFound",
60
60
  GetAllProducers = "getAllProducers",
61
- OnAllProducers = "onAllProducers"
61
+ OnAllProducers = "onAllProducers",
62
+ OnAudioVolumeChanged = "OnAudioVolumeChanged"
62
63
  }
63
- export declare type WebSocketEvents = SFUMessageType | WebSocketBasicEvents;
64
+ export type WebSocketEvents = SFUMessageType | WebSocketBasicEvents;
64
65
  export interface WebSocketMessageBody {
65
66
  type?: WebSocketEvents;
66
67
  data?: any;
@@ -28,7 +28,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
28
28
  function verb(n) { return function (v) { return step([n, v]); }; }
29
29
  function step(op) {
30
30
  if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
32
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
33
  if (y = 0, t) op = [op[0] & 2, t.value];
34
34
  switch (op[0]) {
@@ -115,6 +115,7 @@ export var SFUMessageType;
115
115
  SFUMessageType["OnTransportNotFound"] = "onTransportNotFound";
116
116
  SFUMessageType["GetAllProducers"] = "getAllProducers";
117
117
  SFUMessageType["OnAllProducers"] = "onAllProducers";
118
+ SFUMessageType["OnAudioVolumeChanged"] = "OnAudioVolumeChanged";
118
119
  })(SFUMessageType || (SFUMessageType = {}));
119
120
  var ConnectionType;
120
121
  (function (ConnectionType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -35,7 +35,8 @@
35
35
  },
36
36
  "homepage": "https://vanimeetings.com/",
37
37
  "devDependencies": {
38
- "@types/node": "^16.11.11",
38
+ "@types/node": "^18.14.4",
39
+
39
40
  "prettier": "^2.5.0",
40
41
  "tslint": "^6.1.3",
41
42
  "tslint-config-prettier": "^1.18.0",
@@ -48,6 +49,5 @@
48
49
  "loglevel": "^1.8.0",
49
50
  "mediasoup-client": "^3.6.68",
50
51
  "react-native-google-analytics-bridge": "^7.1.0"
51
- },
52
- "optionalDependencies": {}
52
+ }
53
53
  }