vani-meeting-client 1.8.9 → 1.9.1

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.
@@ -11,7 +11,7 @@ export declare class MeetingHandler {
11
11
  private websocketCallHandler?;
12
12
  private communicationHandler?;
13
13
  private userMediaHandler?;
14
- meetingStartRequestObject(roomId: string, userId: string, appId: string, wssUrl: string): MeetingStartRequest;
14
+ meetingStartRequestObject(roomId: string, userId: string, appId: string, wssUrl: string, shouldIgnoreCaseForRoomId?: boolean): MeetingStartRequest;
15
15
  endAndDestory(): void;
16
16
  requestToCloseTheRoom: () => void;
17
17
  init(): Promise<void>;
@@ -88,12 +88,13 @@ var MeetingHandler = /** @class */ (function () {
88
88
  });
89
89
  }); };
90
90
  }
91
- MeetingHandler.prototype.meetingStartRequestObject = function (roomId, userId, appId, wssUrl) {
91
+ MeetingHandler.prototype.meetingStartRequestObject = function (roomId, userId, appId, wssUrl, shouldIgnoreCaseForRoomId) {
92
+ if (shouldIgnoreCaseForRoomId === void 0) { shouldIgnoreCaseForRoomId = false; }
92
93
  if (!this.meetingStartRequest) {
93
94
  if (roomId === userId) {
94
95
  roomId = roomId + "-r";
95
96
  }
96
- this.meetingStartRequest = new MeetingStartRequest(roomId, userId, appId, wssUrl);
97
+ this.meetingStartRequest = new MeetingStartRequest(roomId, userId, appId, wssUrl, shouldIgnoreCaseForRoomId);
97
98
  }
98
99
  return this.meetingStartRequest;
99
100
  };
@@ -33,7 +33,10 @@ export declare enum VaniEvent {
33
33
  OnReconectionTimeout = "reconectionTimeout",
34
34
  OnReconecting = "reconecting",
35
35
  OnUserOnFoundWhileReconnect = "onUserOnFoundWhileReconnect",
36
- OnNewPingFromServer = "OnNewPingFromServer"
36
+ OnNewPingFromServer = "OnNewPingFromServer",
37
+ OnConsumerScoreChange = "OnConsumerScoreChange",
38
+ OnProducerScoreChange = "OnProducerScoreChange",
39
+ OnConsumerLayerChange = "OnConsumerLayerChange"
37
40
  }
38
41
  interface VaniConnectionEvents {
39
42
  [VaniEvent.OnInitDone]: () => any;
@@ -61,6 +64,21 @@ interface VaniConnectionEvents {
61
64
  participant: Participant;
62
65
  volume: any;
63
66
  }) => any;
67
+ [VaniEvent.OnConsumerScoreChange]: (data: {
68
+ participant: Participant;
69
+ track: Track;
70
+ score: any;
71
+ }) => any;
72
+ [VaniEvent.OnProducerScoreChange]: (data: {
73
+ participant: Participant;
74
+ track: Track;
75
+ score: any;
76
+ }) => any;
77
+ [VaniEvent.OnConsumerLayerChange]: (data: {
78
+ participant: Participant;
79
+ track: Track;
80
+ layer: any;
81
+ }) => any;
64
82
  [VaniEvent.OnNotReachable]: () => any;
65
83
  [VaniEvent.OnReconectionTimeout]: () => any;
66
84
  [VaniEvent.OnReconecting]: () => any;
@@ -32,4 +32,7 @@ export var VaniEvent;
32
32
  VaniEvent["OnReconecting"] = "reconecting";
33
33
  VaniEvent["OnUserOnFoundWhileReconnect"] = "onUserOnFoundWhileReconnect";
34
34
  VaniEvent["OnNewPingFromServer"] = "OnNewPingFromServer";
35
+ VaniEvent["OnConsumerScoreChange"] = "OnConsumerScoreChange";
36
+ VaniEvent["OnProducerScoreChange"] = "OnProducerScoreChange";
37
+ VaniEvent["OnConsumerLayerChange"] = "OnConsumerLayerChange";
35
38
  })(VaniEvent || (VaniEvent = {}));
@@ -50,6 +50,9 @@ export declare class SFUHandler extends BaseVideoCallHandler {
50
50
  private onProducerNotFound;
51
51
  private onTrackEnded;
52
52
  private onNewProducer;
53
+ onConsumerScoreChange: (data: any) => Promise<void>;
54
+ onProducerScoreChange: (data: any) => Promise<void>;
55
+ onConsumerLayerChange: (data: any) => Promise<void>;
53
56
  private onServerConsumer;
54
57
  private onAudioVolumeChanged;
55
58
  private onSpeakerChanged;
@@ -97,6 +97,60 @@ var SFUHandler = /** @class */ (function (_super) {
97
97
  }
98
98
  }
99
99
  };
100
+ _this.onConsumerScoreChange = function (data) { return __awaiter(_this, void 0, void 0, function () {
101
+ var score, consumerId, consumedProducer, track;
102
+ var _a, _b;
103
+ return __generator(this, function (_c) {
104
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onConsumerLayerChange", data);
105
+ score = data.score;
106
+ consumerId = data.consumerId;
107
+ consumedProducer = this.consumers.find(function (eachConsumer) { return eachConsumer.id === consumerId; });
108
+ if (consumedProducer) {
109
+ track = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getAllTracks().find(function (eachTrack) { return consumedProducer.appData.producerData.trackId === eachTrack.trackId; });
110
+ (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.emitMessageToSource(VaniEvent.OnConsumerScoreChange, { track: track, score: score, participant: track === null || track === void 0 ? void 0 : track.participant });
111
+ }
112
+ return [2 /*return*/];
113
+ });
114
+ }); };
115
+ _this.onProducerScoreChange = function (data) { return __awaiter(_this, void 0, void 0, function () {
116
+ var score, producerId, producer, consumedProducer, track, track;
117
+ var _a, _b, _c, _d;
118
+ return __generator(this, function (_e) {
119
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onConsumerLayerChange", data);
120
+ score = data.score;
121
+ producerId = data.producerId;
122
+ producer = this.producers.find(function (producer) { return producer.id === producerId; });
123
+ consumedProducer = this.consumers.find(function (eachConsumer) { return eachConsumer.producerId === producerId; });
124
+ if (consumedProducer) {
125
+ track = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getAllTracks().find(function (eachTrack) { return consumedProducer.appData.producerData.trackId === eachTrack.trackId; });
126
+ (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.emitMessageToSource(VaniEvent.OnProducerScoreChange, { track: track, score: score, participant: track === null || track === void 0 ? void 0 : track.participant });
127
+ }
128
+ if (producer) {
129
+ track = (_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.getAllTracks().find(function (eachTrack) { return (producer.appData).trackId === eachTrack.trackId; });
130
+ if (track) {
131
+ (_d = this.communicationHandler) === null || _d === void 0 ? void 0 : _d.emitMessageToSource(VaniEvent.OnProducerScoreChange, { track: track, score: score, participant: track === null || track === void 0 ? void 0 : track.participant });
132
+ }
133
+ }
134
+ return [2 /*return*/];
135
+ });
136
+ }); };
137
+ _this.onConsumerLayerChange = function (data) { return __awaiter(_this, void 0, void 0, function () {
138
+ var layer, consumerId, consumer, track;
139
+ var _a, _b;
140
+ return __generator(this, function (_c) {
141
+ this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onConsumerLayerChange", data);
142
+ layer = data.layer;
143
+ consumerId = data.consumerId;
144
+ consumer = this.consumers.find(function (consumer) { return consumer.id === consumerId; });
145
+ if (consumer) {
146
+ track = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getAllTracks().find(function (eachTrack) { return consumer.appData.producerData.trackId === eachTrack.trackId; });
147
+ if (track) {
148
+ (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.emitMessageToSource(VaniEvent.OnConsumerLayerChange, { track: track, layer: layer, participant: track.participant });
149
+ }
150
+ }
151
+ return [2 /*return*/];
152
+ });
153
+ }); };
100
154
  var handlerName = detectDevice();
101
155
  if (handlerName) {
102
156
  _this.device = new Device();
@@ -614,6 +668,15 @@ var SFUHandler = /** @class */ (function (_super) {
614
668
  else if (websocketCallHandler.type === SFUMessageType.OnServerConsumer) {
615
669
  this.onServerConsumer(websocketCallHandler.data);
616
670
  }
671
+ else if (websocketCallHandler.type === SFUMessageType.OnConsumerLayerChange) {
672
+ this.onConsumerLayerChange(websocketCallHandler.data);
673
+ }
674
+ else if (websocketCallHandler.type === SFUMessageType.OnConsumerScoreChange) {
675
+ this.onConsumerScoreChange(websocketCallHandler.data);
676
+ }
677
+ else if (websocketCallHandler.type === SFUMessageType.OnProducerScoreChange) {
678
+ this.onProducerScoreChange(websocketCallHandler.data);
679
+ }
617
680
  else if (websocketCallHandler.type === SFUMessageType.OnProduceSyncDone) {
618
681
  this.onProduceSyncDone(websocketCallHandler.data);
619
682
  }
@@ -65,7 +65,10 @@ export declare enum SFUMessageType {
65
65
  OnAllProducers = "onAllProducers",
66
66
  OnAudioVolumeChanged = "OnAudioVolumeChanged",
67
67
  OnConsumerNotFound = "OnConsumerNotFound",
68
- OnProducerNotFound = "OnProducerNotFound"
68
+ OnProducerNotFound = "OnProducerNotFound",
69
+ OnConsumerScoreChange = "OnConsumerScoreChange",
70
+ OnProducerScoreChange = "OnProducerScoreChange",
71
+ OnConsumerLayerChange = "OnConsumerLayerChange"
69
72
  }
70
73
  export type WebSocketEvents = SFUMessageType | WebSocketBasicEvents;
71
74
  export interface WebSocketMessageBody {
@@ -122,6 +122,9 @@ export var SFUMessageType;
122
122
  SFUMessageType["OnAudioVolumeChanged"] = "OnAudioVolumeChanged";
123
123
  SFUMessageType["OnConsumerNotFound"] = "OnConsumerNotFound";
124
124
  SFUMessageType["OnProducerNotFound"] = "OnProducerNotFound";
125
+ SFUMessageType["OnConsumerScoreChange"] = "OnConsumerScoreChange";
126
+ SFUMessageType["OnProducerScoreChange"] = "OnProducerScoreChange";
127
+ SFUMessageType["OnConsumerLayerChange"] = "OnConsumerLayerChange";
125
128
  })(SFUMessageType || (SFUMessageType = {}));
126
129
  var ConnectionType;
127
130
  (function (ConnectionType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "1.8.9",
3
+ "version": "1.9.1",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -42,11 +42,9 @@
42
42
  "typescript": "^4.5.2"
43
43
  },
44
44
  "dependencies": {
45
- "@analytics/google-analytics": "^0.5.3",
46
- "analytics": "^0.7.21",
47
45
  "axios": "^0.24.0",
48
46
  "loglevel": "^1.8.0",
49
- "mediasoup-client": "^3.8.1"
47
+ "mediasoup-client": "^3.11.0"
50
48
  },
51
49
  "optionalDependencies": {}
52
50
  }