vani-meeting-client 1.9.6 → 1.9.8
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.
|
@@ -10,6 +10,7 @@ export declare class CommunicationHandler {
|
|
|
10
10
|
private allParticipants;
|
|
11
11
|
private selfTracks;
|
|
12
12
|
private allTracks;
|
|
13
|
+
private allSelfTracksForRestartSFU;
|
|
13
14
|
private meetingStartRequest?;
|
|
14
15
|
private websocketCallHandler?;
|
|
15
16
|
private videoCallHandler?;
|
|
@@ -62,6 +63,7 @@ export declare class CommunicationHandler {
|
|
|
62
63
|
checkIfInternetReachable: (count: number) => void;
|
|
63
64
|
private onApiResponded;
|
|
64
65
|
restartSFU: () => Promise<void>;
|
|
66
|
+
onSFUInitDone: () => Promise<void>;
|
|
65
67
|
private reloadSFUCleanUpDone;
|
|
66
68
|
cleanup(): void;
|
|
67
69
|
}
|
|
@@ -49,6 +49,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
49
49
|
this.allParticipants = [];
|
|
50
50
|
this.selfTracks = [];
|
|
51
51
|
this.allTracks = [];
|
|
52
|
+
this.allSelfTracksForRestartSFU = undefined;
|
|
52
53
|
this.isReachable = true;
|
|
53
54
|
this.restartTransport = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
54
55
|
var _a;
|
|
@@ -108,12 +109,29 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
108
109
|
var messageJson;
|
|
109
110
|
var _a;
|
|
110
111
|
return __generator(this, function (_b) {
|
|
112
|
+
if (this.allSelfTracksForRestartSFU) {
|
|
113
|
+
return [2 /*return*/];
|
|
114
|
+
}
|
|
111
115
|
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.cleanup(false);
|
|
112
116
|
messageJson = { to: "self", type: SFUMessageType.ReloadSFU, message: SFUMessageType.ReloadSFU };
|
|
113
117
|
this.sendWebSocketMessage(SFUMessageType.SFUMessage, messageJson);
|
|
114
118
|
return [2 /*return*/];
|
|
115
119
|
});
|
|
116
120
|
}); };
|
|
121
|
+
this.onSFUInitDone = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
122
|
+
return __generator(this, function (_a) {
|
|
123
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug &&
|
|
124
|
+
console.log("onSFUInitDone", this.allSelfTracksForRestartSFU);
|
|
125
|
+
this.emitMessageToSource(VaniEvent.OnSFUConnected, undefined);
|
|
126
|
+
if (this.allSelfTracksForRestartSFU) {
|
|
127
|
+
this.emitMessageToSource(VaniEvent.ResendTracks, this.allSelfTracksForRestartSFU);
|
|
128
|
+
if (this.allSelfTracksForRestartSFU && this.allSelfTracksForRestartSFU.length === 0) {
|
|
129
|
+
this.allSelfTracksForRestartSFU = undefined;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return [2 /*return*/];
|
|
133
|
+
});
|
|
134
|
+
}); };
|
|
117
135
|
this.reloadSFUCleanUpDone = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
118
136
|
var videoCallHandler;
|
|
119
137
|
var _a;
|
|
@@ -121,8 +139,10 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
121
139
|
switch (_b.label) {
|
|
122
140
|
case 0:
|
|
123
141
|
this.videoCallHandler = undefined;
|
|
124
|
-
this.
|
|
125
|
-
this.
|
|
142
|
+
this.allSelfTracksForRestartSFU = this.allTracks.filter(function (eachTrack) { return eachTrack.isLocalTrack === true; });
|
|
143
|
+
this.allTracks = [];
|
|
144
|
+
this.selfTracks = [];
|
|
145
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("reloadSFUCleanUpDone", this.allSelfTracksForRestartSFU);
|
|
126
146
|
return [4 /*yield*/, ((_a = this.meetingHandler) === null || _a === void 0 ? void 0 : _a.recreateVideoCallHandler())];
|
|
127
147
|
case 1:
|
|
128
148
|
videoCallHandler = _b.sent();
|
|
@@ -395,6 +415,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
395
415
|
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.sendTrack(track);
|
|
396
416
|
}
|
|
397
417
|
this.emitMessageToSource(VaniEvent.OnTrack, track);
|
|
418
|
+
this.allSelfTracksForRestartSFU = undefined;
|
|
398
419
|
};
|
|
399
420
|
CommunicationHandler.prototype.onOldMessages = function (data) {
|
|
400
421
|
var _this = this;
|
|
@@ -547,6 +568,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
547
568
|
this.selfTracks.forEach(function (eachTrack) {
|
|
548
569
|
_this.removeTrack(eachTrack, false);
|
|
549
570
|
});
|
|
571
|
+
this.allSelfTracksForRestartSFU = undefined;
|
|
550
572
|
this.eventEmitter.removeAllListeners();
|
|
551
573
|
this.videoCallHandler = undefined;
|
|
552
574
|
this.meetingStartRequest = undefined;
|
package/lib/model/Event.d.ts
CHANGED
|
@@ -36,7 +36,9 @@ export declare enum VaniEvent {
|
|
|
36
36
|
OnNewPingFromServer = "OnNewPingFromServer",
|
|
37
37
|
OnConsumerScoreChange = "OnConsumerScoreChange",
|
|
38
38
|
OnProducerScoreChange = "OnProducerScoreChange",
|
|
39
|
-
OnConsumerLayerChange = "OnConsumerLayerChange"
|
|
39
|
+
OnConsumerLayerChange = "OnConsumerLayerChange",
|
|
40
|
+
OnSFUConnected = "OnSFUReconnected",
|
|
41
|
+
ResendTracks = "ResendTracks"
|
|
40
42
|
}
|
|
41
43
|
interface VaniConnectionEvents {
|
|
42
44
|
[VaniEvent.OnInitDone]: () => any;
|
|
@@ -88,6 +90,8 @@ interface VaniConnectionEvents {
|
|
|
88
90
|
[VaniEvent.OnVideoBlocked]: (participant: Participant) => any;
|
|
89
91
|
[VaniEvent.OnAudioBlocked]: (participant: Participant) => any;
|
|
90
92
|
[VaniEvent.OnSocketDisconnected]: () => any;
|
|
93
|
+
[VaniEvent.OnSFUConnected]: () => any;
|
|
94
|
+
[VaniEvent.ResendTracks]: (tracks: Track[]) => any;
|
|
91
95
|
[VaniEvent.OnAskedToCloseTheRoom]: () => any;
|
|
92
96
|
}
|
|
93
97
|
export declare interface VaniEventListener {
|
package/lib/model/Event.js
CHANGED
|
@@ -35,4 +35,6 @@ export var VaniEvent;
|
|
|
35
35
|
VaniEvent["OnConsumerScoreChange"] = "OnConsumerScoreChange";
|
|
36
36
|
VaniEvent["OnProducerScoreChange"] = "OnProducerScoreChange";
|
|
37
37
|
VaniEvent["OnConsumerLayerChange"] = "OnConsumerLayerChange";
|
|
38
|
+
VaniEvent["OnSFUConnected"] = "OnSFUReconnected";
|
|
39
|
+
VaniEvent["ResendTracks"] = "ResendTracks";
|
|
38
40
|
})(VaniEvent || (VaniEvent = {}));
|
|
@@ -666,7 +666,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
666
666
|
};
|
|
667
667
|
SFUHandler.prototype.produceTracks = function () {
|
|
668
668
|
var _this = this;
|
|
669
|
-
var _a;
|
|
669
|
+
var _a, _b;
|
|
670
670
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("produceTracks");
|
|
671
671
|
if (!this.sendTransport || !this.consumerTransport || this.isProduceTrackIntialWorkDone) {
|
|
672
672
|
return;
|
|
@@ -682,6 +682,8 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
682
682
|
else {
|
|
683
683
|
this.sendMessageReadyToConsume();
|
|
684
684
|
}
|
|
685
|
+
//inform init is done(mainly used when restart SFU)
|
|
686
|
+
(_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.onSFUInitDone();
|
|
685
687
|
// if (this.meetingStartRequest?.isDataChannelRequired) {
|
|
686
688
|
// this.createDataChannel()
|
|
687
689
|
// }
|