vani-meeting-client 0.8.2 → 0.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.
package/lib/model/Event.d.ts
CHANGED
|
@@ -29,7 +29,8 @@ export declare enum VaniEvent {
|
|
|
29
29
|
OnSpeakerChanged = "onSpeakerChanged",
|
|
30
30
|
OnNotReachable = "notReachable",
|
|
31
31
|
OnReconectionTimeout = "reconectionTimeout",
|
|
32
|
-
OnReconecting = "reconecting"
|
|
32
|
+
OnReconecting = "reconecting",
|
|
33
|
+
OnUserOnFoundWhileReconnect = "onUserOnFoundWhileReconnect"
|
|
33
34
|
}
|
|
34
35
|
interface VaniConnectionEvents {
|
|
35
36
|
[VaniEvent.OnInitDone]: () => any;
|
|
@@ -55,6 +56,7 @@ interface VaniConnectionEvents {
|
|
|
55
56
|
[VaniEvent.OnNotReachable]: () => any;
|
|
56
57
|
[VaniEvent.OnReconectionTimeout]: () => any;
|
|
57
58
|
[VaniEvent.OnReconecting]: () => any;
|
|
59
|
+
[VaniEvent.OnUserOnFoundWhileReconnect]: () => any;
|
|
58
60
|
[VaniEvent.OnVideoUnblocked]: (participant: Participant) => any;
|
|
59
61
|
[VaniEvent.OnAudioUnblocked]: (participant: Participant) => any;
|
|
60
62
|
[VaniEvent.OnVideoBlocked]: (participant: Participant) => any;
|
package/lib/model/Event.js
CHANGED
|
@@ -28,4 +28,5 @@ export var VaniEvent;
|
|
|
28
28
|
VaniEvent["OnNotReachable"] = "notReachable";
|
|
29
29
|
VaniEvent["OnReconectionTimeout"] = "reconectionTimeout";
|
|
30
30
|
VaniEvent["OnReconecting"] = "reconecting";
|
|
31
|
+
VaniEvent["OnUserOnFoundWhileReconnect"] = "onUserOnFoundWhileReconnect";
|
|
31
32
|
})(VaniEvent || (VaniEvent = {}));
|
|
@@ -16,6 +16,8 @@ export declare enum WebSocketBasicEvents {
|
|
|
16
16
|
UpdateParticipant = "updateParticipant",
|
|
17
17
|
OnParticipantUpdated = "participantUpdated",
|
|
18
18
|
OnNewJoinee = "newJoinee",
|
|
19
|
+
OnUserOnFoundWhileReconnect = "onUserOnFoundWhileReconnect",
|
|
20
|
+
OnRejoined = "OnRejoined",
|
|
19
21
|
OnUserLeft = "userLeft",
|
|
20
22
|
GetAllParticipant = "getParticipant",
|
|
21
23
|
OnServerParticipants = "participants",
|
|
@@ -24,7 +26,8 @@ export declare enum WebSocketBasicEvents {
|
|
|
24
26
|
GetOldMessages = "getOldMessages",
|
|
25
27
|
OnOldMessages = "oldMessages",
|
|
26
28
|
Message = "message",
|
|
27
|
-
OnChat = "chat"
|
|
29
|
+
OnChat = "chat",
|
|
30
|
+
SelfLeft = "selfLeft"
|
|
28
31
|
}
|
|
29
32
|
export declare enum SFUMessageType {
|
|
30
33
|
SFUMessage = "sfuMessage",
|
|
@@ -71,6 +71,8 @@ export var WebSocketBasicEvents;
|
|
|
71
71
|
WebSocketBasicEvents["UpdateParticipant"] = "updateParticipant";
|
|
72
72
|
WebSocketBasicEvents["OnParticipantUpdated"] = "participantUpdated";
|
|
73
73
|
WebSocketBasicEvents["OnNewJoinee"] = "newJoinee";
|
|
74
|
+
WebSocketBasicEvents["OnUserOnFoundWhileReconnect"] = "onUserOnFoundWhileReconnect";
|
|
75
|
+
WebSocketBasicEvents["OnRejoined"] = "OnRejoined";
|
|
74
76
|
WebSocketBasicEvents["OnUserLeft"] = "userLeft";
|
|
75
77
|
WebSocketBasicEvents["GetAllParticipant"] = "getParticipant";
|
|
76
78
|
WebSocketBasicEvents["OnServerParticipants"] = "participants";
|
|
@@ -80,6 +82,7 @@ export var WebSocketBasicEvents;
|
|
|
80
82
|
WebSocketBasicEvents["OnOldMessages"] = "oldMessages";
|
|
81
83
|
WebSocketBasicEvents["Message"] = "message";
|
|
82
84
|
WebSocketBasicEvents["OnChat"] = "chat";
|
|
85
|
+
WebSocketBasicEvents["SelfLeft"] = "selfLeft";
|
|
83
86
|
})(WebSocketBasicEvents || (WebSocketBasicEvents = {}));
|
|
84
87
|
export var SFUMessageType;
|
|
85
88
|
(function (SFUMessageType) {
|
|
@@ -136,6 +139,13 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
136
139
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.setWebsocketCallHandler(this);
|
|
137
140
|
};
|
|
138
141
|
WebsocketHandler.prototype.cleanup = function () {
|
|
142
|
+
var _a;
|
|
143
|
+
try {
|
|
144
|
+
var data = { userId: (_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId };
|
|
145
|
+
this.sendSocketMessage(WebSocketBasicEvents.SelfLeft, data);
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
}
|
|
139
149
|
this.loadBalancerIpAddressForWebSocket = undefined;
|
|
140
150
|
this.isEnded = true;
|
|
141
151
|
if (this.wss) {
|
|
@@ -363,7 +373,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
363
373
|
}, 200);
|
|
364
374
|
};
|
|
365
375
|
WebsocketHandler.prototype.onMessage = function (message) {
|
|
366
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
376
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
367
377
|
this.lastPingTimeStamp = new Date().getTime();
|
|
368
378
|
var messagejson = JSON.parse(message);
|
|
369
379
|
if (messagejson.type && messagejson.data) {
|
|
@@ -379,29 +389,32 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
379
389
|
else if (type === WebSocketBasicEvents.IsSetupDone) {
|
|
380
390
|
this.onSetupDone(data);
|
|
381
391
|
}
|
|
382
|
-
else if (type === WebSocketBasicEvents.
|
|
392
|
+
else if (type === WebSocketBasicEvents.OnUserOnFoundWhileReconnect) {
|
|
393
|
+
(_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.emitMessageToSource(VaniEvent.OnUserOnFoundWhileReconnect, {});
|
|
394
|
+
}
|
|
395
|
+
else if (type === WebSocketBasicEvents.OnNewJoinee || type === WebSocketBasicEvents.OnRejoined) {
|
|
383
396
|
if (data && data.message && data.message.participant) {
|
|
384
397
|
console.log("OnParticipantUpdated from server", data.message.participant);
|
|
385
|
-
(
|
|
398
|
+
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.addParticipantIfNotExist(data.message.participant, true);
|
|
386
399
|
}
|
|
387
400
|
}
|
|
388
401
|
else if (type === WebSocketBasicEvents.OnParticipantUpdated) {
|
|
389
402
|
if (data) {
|
|
390
|
-
(
|
|
403
|
+
(_d = this.communicationHandler) === null || _d === void 0 ? void 0 : _d.addParticipantIfNotExist(data, true);
|
|
391
404
|
}
|
|
392
405
|
}
|
|
393
406
|
else if (type === WebSocketBasicEvents.OnUserLeft) {
|
|
394
|
-
(
|
|
407
|
+
(_e = this.communicationHandler) === null || _e === void 0 ? void 0 : _e.onUserLeft(data);
|
|
395
408
|
}
|
|
396
409
|
else if (type === WebSocketBasicEvents.OnServerParticipants) {
|
|
397
|
-
(
|
|
410
|
+
(_f = this.communicationHandler) === null || _f === void 0 ? void 0 : _f.onServerParticipants(data);
|
|
398
411
|
}
|
|
399
412
|
else if (type === WebSocketBasicEvents.OnOldMessages) {
|
|
400
|
-
(
|
|
413
|
+
(_g = this.communicationHandler) === null || _g === void 0 ? void 0 : _g.onOldMessages(data);
|
|
401
414
|
}
|
|
402
415
|
else if (type === WebSocketBasicEvents.OnChat) {
|
|
403
416
|
if (data.message) {
|
|
404
|
-
(
|
|
417
|
+
(_h = this.communicationHandler) === null || _h === void 0 ? void 0 : _h.onMessage(data.message);
|
|
405
418
|
}
|
|
406
419
|
}
|
|
407
420
|
else if (type === WebSocketBasicEvents.OnMeetingStartTime) {
|
|
@@ -410,23 +423,23 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
410
423
|
if (time > new Date().getTime()) {
|
|
411
424
|
time = new Date().getTime();
|
|
412
425
|
}
|
|
413
|
-
(
|
|
426
|
+
(_j = this.communicationHandler) === null || _j === void 0 ? void 0 : _j.emitMessageToSource(VaniEvent.OnMeetingStartTime, (time + ""));
|
|
414
427
|
}
|
|
415
428
|
}
|
|
416
429
|
else if (type === WebSocketBasicEvents.OnAudioVideoStatusUpdated) {
|
|
417
|
-
(
|
|
430
|
+
(_k = this.communicationHandler) === null || _k === void 0 ? void 0 : _k.onAudioVideoStatusUpdated(data);
|
|
418
431
|
}
|
|
419
432
|
else if (type === WebSocketBasicEvents.OnAudioBlockRequest) {
|
|
420
|
-
(
|
|
433
|
+
(_l = this.communicationHandler) === null || _l === void 0 ? void 0 : _l.onAudioBlocked(data);
|
|
421
434
|
}
|
|
422
435
|
else if (type === WebSocketBasicEvents.OnAudioUnblockRequest) {
|
|
423
|
-
(
|
|
436
|
+
(_m = this.communicationHandler) === null || _m === void 0 ? void 0 : _m.onAudioUnblocked(data);
|
|
424
437
|
}
|
|
425
438
|
else if (type === WebSocketBasicEvents.OnVideoBlockRequest) {
|
|
426
|
-
(
|
|
439
|
+
(_o = this.communicationHandler) === null || _o === void 0 ? void 0 : _o.onVideoBlocked(data);
|
|
427
440
|
}
|
|
428
441
|
else if (type === WebSocketBasicEvents.OnVideoUnblockRequest) {
|
|
429
|
-
(
|
|
442
|
+
(_p = this.communicationHandler) === null || _p === void 0 ? void 0 : _p.onVideoUnblocked(data);
|
|
430
443
|
}
|
|
431
444
|
}
|
|
432
445
|
};
|