vani-meeting-client 0.1.6 → 0.2.0
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.
- package/lib/inter-communication-handler/CommunicationHandler.js +0 -1
- package/lib/model/MeetingStartRequest.d.ts +1 -0
- package/lib/model/MeetingStartRequest.js +1 -0
- package/lib/video-call-handler/SFUHandler.js +11 -8
- package/lib/websocket-handler/WebsocketHandler.d.ts +4 -0
- package/lib/websocket-handler/WebsocketHandler.js +40 -0
- package/package.json +1 -1
|
@@ -350,7 +350,6 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
350
350
|
this.internetReachbilityTimeout = undefined;
|
|
351
351
|
if (count < 2 && ((_a = this.websocketCallHandler) === null || _a === void 0 ? void 0 : _a.isWebScoketConnected())) {
|
|
352
352
|
(_b = this.videoCallHandler) === null || _b === void 0 ? void 0 : _b.reconnectedWithoutPing();
|
|
353
|
-
return;
|
|
354
353
|
}
|
|
355
354
|
(_c = this.websocketCallHandler) === null || _c === void 0 ? void 0 : _c.reconnectOnInternetFailur();
|
|
356
355
|
}
|
|
@@ -22,6 +22,7 @@ var MeetingStartRequest = /** @class */ (function () {
|
|
|
22
22
|
this.shouldForceTurn = false;
|
|
23
23
|
this.minBitrateConfig = 40000;
|
|
24
24
|
this.maxBitRateConfig = 620000;
|
|
25
|
+
this.maxAudioBitrateConfig = -1;
|
|
25
26
|
this.logLevel = "TRACE";
|
|
26
27
|
this.isRecordingUser = false;
|
|
27
28
|
this.meetingType = MeetingType.SFU;
|
|
@@ -161,18 +161,18 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
161
161
|
});
|
|
162
162
|
};
|
|
163
163
|
SFUHandler.prototype.sendTrack = function (track) {
|
|
164
|
-
var _a, _b;
|
|
164
|
+
var _a, _b, _c;
|
|
165
165
|
return __awaiter(this, void 0, void 0, function () {
|
|
166
166
|
var producer, appData, producerData, webcamProducer;
|
|
167
|
-
return __generator(this, function (
|
|
168
|
-
switch (
|
|
167
|
+
return __generator(this, function (_d) {
|
|
168
|
+
switch (_d.label) {
|
|
169
169
|
case 0:
|
|
170
170
|
if (!(track && track.track)) return [3 /*break*/, 4];
|
|
171
171
|
producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
|
|
172
172
|
if (!producer) return [3 /*break*/, 2];
|
|
173
173
|
return [4 /*yield*/, producer.replaceTrack({ track: track.track })];
|
|
174
174
|
case 1:
|
|
175
|
-
|
|
175
|
+
_d.sent();
|
|
176
176
|
this.resumeTrack(track);
|
|
177
177
|
return [3 /*break*/, 4];
|
|
178
178
|
case 2:
|
|
@@ -184,18 +184,21 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
184
184
|
producerData.encodings = this.meetingStartRequest.simulcastEncodings;
|
|
185
185
|
}
|
|
186
186
|
if (track.track.kind === "audio") {
|
|
187
|
-
producerData.codecOptions = { opusStereo: true,
|
|
187
|
+
producerData.codecOptions = { opusStereo: true, opusFec: true };
|
|
188
|
+
if (this.meetingStartRequest.maxAudioBitrateConfig > 0) {
|
|
189
|
+
producerData.codecOptions.opusMaxAverageBitrate = (_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.maxAudioBitrateConfig;
|
|
190
|
+
}
|
|
188
191
|
}
|
|
189
192
|
log.info(producerData);
|
|
190
|
-
return [4 /*yield*/, ((
|
|
193
|
+
return [4 /*yield*/, ((_c = this.sendTransport) === null || _c === void 0 ? void 0 : _c.produce(producerData))];
|
|
191
194
|
case 3:
|
|
192
|
-
webcamProducer =
|
|
195
|
+
webcamProducer = _d.sent();
|
|
193
196
|
if (webcamProducer) {
|
|
194
197
|
this.producers.push(webcamProducer);
|
|
195
198
|
this.onParticipantUpdated();
|
|
196
199
|
// this.sendMessageReadyToConsume();
|
|
197
200
|
}
|
|
198
|
-
|
|
201
|
+
_d.label = 4;
|
|
199
202
|
case 4: return [2 /*return*/];
|
|
200
203
|
}
|
|
201
204
|
});
|
|
@@ -64,7 +64,9 @@ export declare class WebsocketHandler extends Base {
|
|
|
64
64
|
private connection;
|
|
65
65
|
private isSetUpDone;
|
|
66
66
|
private socketCheckTimeout?;
|
|
67
|
+
private pingCheckTimeout?;
|
|
67
68
|
private setUpTry;
|
|
69
|
+
private lastPingTimeStamp;
|
|
68
70
|
protected onObjectCreated(): void;
|
|
69
71
|
cleanup(): void;
|
|
70
72
|
startSocketConnection(): Promise<void>;
|
|
@@ -72,6 +74,7 @@ export declare class WebsocketHandler extends Base {
|
|
|
72
74
|
isWebScoketConnected(): boolean;
|
|
73
75
|
sendSocketMessage(type: WebSocketEvents, data: any): void;
|
|
74
76
|
reconnectOnInternetFailur(): void;
|
|
77
|
+
private checkIfSocketConnected;
|
|
75
78
|
private onWebSocketClosed;
|
|
76
79
|
private tryToReconectSocket;
|
|
77
80
|
private onSocketConnected;
|
|
@@ -79,5 +82,6 @@ export declare class WebsocketHandler extends Base {
|
|
|
79
82
|
private askIfSetupDone;
|
|
80
83
|
private onMessage;
|
|
81
84
|
private onSetupDone;
|
|
85
|
+
private checkIfPingIsRunning;
|
|
82
86
|
private isVideoCallControllerMessageType;
|
|
83
87
|
}
|
|
@@ -121,6 +121,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
121
121
|
_this.connection = ConnectionType.new;
|
|
122
122
|
_this.isSetUpDone = false;
|
|
123
123
|
_this.setUpTry = 0;
|
|
124
|
+
_this.lastPingTimeStamp = 0;
|
|
124
125
|
return _this;
|
|
125
126
|
}
|
|
126
127
|
WebsocketHandler.prototype.onObjectCreated = function () {
|
|
@@ -139,6 +140,10 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
139
140
|
window.clearTimeout(this.socketCheckTimeout);
|
|
140
141
|
this.socketCheckTimeout = undefined;
|
|
141
142
|
}
|
|
143
|
+
if (this.pingCheckTimeout) {
|
|
144
|
+
window.clearTimeout(this.pingCheckTimeout);
|
|
145
|
+
this.pingCheckTimeout = undefined;
|
|
146
|
+
}
|
|
142
147
|
};
|
|
143
148
|
WebsocketHandler.prototype.startSocketConnection = function () {
|
|
144
149
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -211,6 +216,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
211
216
|
this.wss = new WebSocket(url + this.connection);
|
|
212
217
|
}
|
|
213
218
|
this.wss.onopen = function (event) {
|
|
219
|
+
_this.checkIfSocketConnected();
|
|
214
220
|
log.info("connected ----");
|
|
215
221
|
_this.isWebSocketConnectionInProgress = false;
|
|
216
222
|
_this.isSetUpDone = false;
|
|
@@ -267,6 +273,18 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
267
273
|
this.connect(true);
|
|
268
274
|
}
|
|
269
275
|
};
|
|
276
|
+
WebsocketHandler.prototype.checkIfSocketConnected = function () {
|
|
277
|
+
var _this = this;
|
|
278
|
+
window.setTimeout(function () {
|
|
279
|
+
if (_this.isWebScoketConnected()) {
|
|
280
|
+
log.info("Connected");
|
|
281
|
+
_this.checkIfSocketConnected();
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
log.info("Not Connected");
|
|
285
|
+
}
|
|
286
|
+
}, 1000);
|
|
287
|
+
};
|
|
270
288
|
WebsocketHandler.prototype.onWebSocketClosed = function (event) {
|
|
271
289
|
var _this = this;
|
|
272
290
|
log.info("onWebSocketClosed");
|
|
@@ -330,6 +348,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
330
348
|
};
|
|
331
349
|
WebsocketHandler.prototype.onMessage = function (message) {
|
|
332
350
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
351
|
+
this.lastPingTimeStamp = new Date().getTime();
|
|
333
352
|
var messagejson = JSON.parse(message);
|
|
334
353
|
if (messagejson.type && messagejson.data) {
|
|
335
354
|
var type = messagejson.type;
|
|
@@ -397,6 +416,27 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
397
416
|
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.emitMessageToSource(VaniEvent.OnConnected, {});
|
|
398
417
|
}
|
|
399
418
|
}
|
|
419
|
+
if (this.pingCheckTimeout) {
|
|
420
|
+
window.clearTimeout(this.pingCheckTimeout);
|
|
421
|
+
this.pingCheckTimeout = undefined;
|
|
422
|
+
}
|
|
423
|
+
this.checkIfPingIsRunning();
|
|
424
|
+
};
|
|
425
|
+
WebsocketHandler.prototype.checkIfPingIsRunning = function () {
|
|
426
|
+
var _this = this;
|
|
427
|
+
var _a;
|
|
428
|
+
if (this.isWebScoketConnected()) {
|
|
429
|
+
if ((this.lastPingTimeStamp + (40 * 1000)) < new Date().getTime()) {
|
|
430
|
+
this.pingCheckTimeout = undefined;
|
|
431
|
+
//Discounted
|
|
432
|
+
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.onIceCandidateDisconnected();
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
this.pingCheckTimeout = window.setTimeout(function () {
|
|
436
|
+
_this.checkIfPingIsRunning();
|
|
437
|
+
}, 30 * 1000);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
400
440
|
};
|
|
401
441
|
WebsocketHandler.prototype.isVideoCallControllerMessageType = function (type) {
|
|
402
442
|
if (Object.values(SFUMessageType).includes(type)) {
|