vani-meeting-client 2.1.1 → 2.1.3
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/MeetingHandler.js +31 -10
- package/lib/inter-communication-handler/CommunicationHandler.d.ts +1 -1
- package/lib/inter-communication-handler/CommunicationHandler.js +25 -11
- package/lib/model/Event.d.ts +2 -0
- package/lib/model/Event.js +1 -0
- package/lib/user-media-handler/UserMediaHandler.d.ts +1 -1
- package/lib/user-media-handler/UserMediaHandler.js +12 -7
- package/lib/video-call-handler/BaseVideoCallHandler.d.ts +1 -1
- package/lib/video-call-handler/BaseVideoCallHandler.js +7 -2
- package/lib/video-call-handler/SFUHandler.d.ts +1 -1
- package/lib/video-call-handler/SFUHandler.js +64 -59
- package/lib/websocket-handler/WebsocketHandler.d.ts +1 -1
- package/lib/websocket-handler/WebsocketHandler.js +37 -26
- package/package.json +1 -1
package/lib/MeetingHandler.js
CHANGED
|
@@ -520,16 +520,37 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
520
520
|
};
|
|
521
521
|
MeetingHandler.prototype.cleanup = function () {
|
|
522
522
|
var _a, _b, _c, _d;
|
|
523
|
-
this
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
523
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
524
|
+
return __generator(this, function (_e) {
|
|
525
|
+
this.meetingStartRequest = undefined;
|
|
526
|
+
this.reactNativeWebrtcPlugin = undefined;
|
|
527
|
+
try {
|
|
528
|
+
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
529
|
+
this.communicationHandler = undefined;
|
|
530
|
+
}
|
|
531
|
+
catch (err) {
|
|
532
|
+
}
|
|
533
|
+
try {
|
|
534
|
+
(_b = this.videoCallHandler) === null || _b === void 0 ? void 0 : _b.cleanup();
|
|
535
|
+
this.videoCallHandler = undefined;
|
|
536
|
+
}
|
|
537
|
+
catch (err) {
|
|
538
|
+
}
|
|
539
|
+
try {
|
|
540
|
+
(_c = this.websocketCallHandler) === null || _c === void 0 ? void 0 : _c.cleanup();
|
|
541
|
+
this.websocketCallHandler = undefined;
|
|
542
|
+
}
|
|
543
|
+
catch (err) {
|
|
544
|
+
}
|
|
545
|
+
try {
|
|
546
|
+
(_d = this.userMediaHandler) === null || _d === void 0 ? void 0 : _d.cleanup();
|
|
547
|
+
this.userMediaHandler = undefined;
|
|
548
|
+
}
|
|
549
|
+
catch (err) {
|
|
550
|
+
}
|
|
551
|
+
return [2 /*return*/];
|
|
552
|
+
});
|
|
553
|
+
});
|
|
533
554
|
};
|
|
534
555
|
MeetingHandler.prototype.handleGA = function () {
|
|
535
556
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -77,9 +77,13 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
77
77
|
(_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
if (count ===
|
|
80
|
+
if (count === 10) {
|
|
81
81
|
_this.emitMessageToSource(VaniEvent.OnNotReachable, {});
|
|
82
|
+
if (_this.meetingStartRequest.isMobileApp) {
|
|
83
|
+
_this.emitMessageToSource(VaniEvent.OnSocketError, {});
|
|
84
|
+
}
|
|
82
85
|
}
|
|
86
|
+
_this.emitMessageToSource(VaniEvent.CheckingInternetConnection, {});
|
|
83
87
|
_this.isReachable = false;
|
|
84
88
|
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("checkIfInternetReachable");
|
|
85
89
|
fetch(_this.meetingStartRequest.urlToCheckInternetPresent, {
|
|
@@ -560,20 +564,30 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
560
564
|
// if (count < 2 && this.websocketCallHandler?.isWebScoketConnected()) {
|
|
561
565
|
// this.videoCallHandler?.reconnectedWithoutPing()
|
|
562
566
|
// }
|
|
563
|
-
(
|
|
567
|
+
if (this.meetingStartRequest && this.meetingStartRequest.isMobileApp) {
|
|
568
|
+
this.websocketCallHandler.reconnectOnInternetFailur();
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.reconnectedWithoutPing();
|
|
572
|
+
}
|
|
564
573
|
}
|
|
565
574
|
};
|
|
566
575
|
CommunicationHandler.prototype.cleanup = function () {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
576
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
577
|
+
var _this = this;
|
|
578
|
+
return __generator(this, function (_a) {
|
|
579
|
+
this.selfTracks.forEach(function (eachTrack) {
|
|
580
|
+
_this.removeTrack(eachTrack, false);
|
|
581
|
+
});
|
|
582
|
+
this.allSelfTracksForRestartSFU = undefined;
|
|
583
|
+
this.eventEmitter.removeAllListeners();
|
|
584
|
+
this.videoCallHandler = undefined;
|
|
585
|
+
this.meetingStartRequest = undefined;
|
|
586
|
+
this.websocketCallHandler = undefined;
|
|
587
|
+
this.meetingHandler = undefined;
|
|
588
|
+
return [2 /*return*/];
|
|
589
|
+
});
|
|
570
590
|
});
|
|
571
|
-
this.allSelfTracksForRestartSFU = undefined;
|
|
572
|
-
this.eventEmitter.removeAllListeners();
|
|
573
|
-
this.videoCallHandler = undefined;
|
|
574
|
-
this.meetingStartRequest = undefined;
|
|
575
|
-
this.websocketCallHandler = undefined;
|
|
576
|
-
this.meetingHandler = undefined;
|
|
577
591
|
};
|
|
578
592
|
return CommunicationHandler;
|
|
579
593
|
}());
|
package/lib/model/Event.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare enum VaniEvent {
|
|
|
29
29
|
OnOldMessages = "onOldMessages",
|
|
30
30
|
OnSpeakerChanged = "onSpeakerChanged",
|
|
31
31
|
OnAudioVolumeChanged = "OnAudioVolumeChanged",
|
|
32
|
+
CheckingInternetConnection = "CheckingInternetConnection",
|
|
32
33
|
OnNotReachable = "notReachable",
|
|
33
34
|
OnReconectionTimeout = "reconectionTimeout",
|
|
34
35
|
OnReconecting = "reconecting",
|
|
@@ -45,6 +46,7 @@ interface VaniConnectionEvents {
|
|
|
45
46
|
[VaniEvent.OnSocketError]: (error: any) => any;
|
|
46
47
|
[VaniEvent.OnSocketConnected]: () => any;
|
|
47
48
|
[VaniEvent.OnSocketReconnectTimeOut]: () => any;
|
|
49
|
+
[VaniEvent.CheckingInternetConnection]: () => any;
|
|
48
50
|
[VaniEvent.OnConnected]: () => any;
|
|
49
51
|
[VaniEvent.OnConnectionBack]: () => any;
|
|
50
52
|
[VaniEvent.OnPermissionError]: (error: DOMException) => any;
|
package/lib/model/Event.js
CHANGED
|
@@ -27,6 +27,7 @@ export var VaniEvent;
|
|
|
27
27
|
VaniEvent["OnOldMessages"] = "onOldMessages";
|
|
28
28
|
VaniEvent["OnSpeakerChanged"] = "onSpeakerChanged";
|
|
29
29
|
VaniEvent["OnAudioVolumeChanged"] = "OnAudioVolumeChanged";
|
|
30
|
+
VaniEvent["CheckingInternetConnection"] = "CheckingInternetConnection";
|
|
30
31
|
VaniEvent["OnNotReachable"] = "notReachable";
|
|
31
32
|
VaniEvent["OnReconectionTimeout"] = "reconectionTimeout";
|
|
32
33
|
VaniEvent["OnReconecting"] = "reconecting";
|
|
@@ -34,5 +34,5 @@ export declare class UserMediaHandler extends Base {
|
|
|
34
34
|
unmute(userId?: string): Promise<TaskResponse>;
|
|
35
35
|
pauseStreamWithoutStopping(streamKind: TrackKind): TaskResponse;
|
|
36
36
|
resumeStreamWithoutAdding(streamKind: TrackKind): TaskResponse;
|
|
37
|
-
cleanup(): void
|
|
37
|
+
cleanup(): Promise<void>;
|
|
38
38
|
}
|
|
@@ -799,14 +799,19 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
799
799
|
}
|
|
800
800
|
};
|
|
801
801
|
UserMediaHandler.prototype.cleanup = function () {
|
|
802
|
-
this
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
802
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
803
|
+
return __generator(this, function (_a) {
|
|
804
|
+
this.tracks.forEach(function (eachTrack) {
|
|
805
|
+
try {
|
|
806
|
+
eachTrack.stop();
|
|
807
|
+
}
|
|
808
|
+
catch (err) {
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
_super.prototype.cleanup.call(this);
|
|
812
|
+
return [2 /*return*/];
|
|
813
|
+
});
|
|
808
814
|
});
|
|
809
|
-
_super.prototype.cleanup.call(this);
|
|
810
815
|
};
|
|
811
816
|
return UserMediaHandler;
|
|
812
817
|
}(Base));
|
|
@@ -21,7 +21,7 @@ export declare abstract class BaseVideoCallHandler extends Base {
|
|
|
21
21
|
pauseProducerOrConsumerForTrack(track: Track): Promise<void>;
|
|
22
22
|
reconnectedWithoutPing(): void;
|
|
23
23
|
updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
|
|
24
|
-
cleanup(shouldStopTracks?: boolean): void
|
|
24
|
+
cleanup(shouldStopTracks?: boolean): Promise<void>;
|
|
25
25
|
restartTransport(): void;
|
|
26
26
|
getClientStats: () => Promise<TrackStats[]>;
|
|
27
27
|
}
|
|
@@ -95,8 +95,13 @@ var BaseVideoCallHandler = /** @class */ (function (_super) {
|
|
|
95
95
|
};
|
|
96
96
|
BaseVideoCallHandler.prototype.cleanup = function (shouldStopTracks) {
|
|
97
97
|
if (shouldStopTracks === void 0) { shouldStopTracks = true; }
|
|
98
|
-
this
|
|
99
|
-
|
|
98
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("cleanup ");
|
|
101
|
+
_super.prototype.cleanup.call(this);
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
});
|
|
104
|
+
});
|
|
100
105
|
};
|
|
101
106
|
BaseVideoCallHandler.prototype.restartTransport = function () {
|
|
102
107
|
};
|
|
@@ -59,5 +59,5 @@ export declare class SFUHandler extends BaseVideoCallHandler {
|
|
|
59
59
|
private onSpeakerChanged;
|
|
60
60
|
getClientStats: () => Promise<TrackStats[]>;
|
|
61
61
|
private eachTrackStats;
|
|
62
|
-
cleanup(shouldStopTracks?: boolean): void
|
|
62
|
+
cleanup(shouldStopTracks?: boolean): Promise<void>;
|
|
63
63
|
}
|
|
@@ -885,77 +885,82 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
885
885
|
};
|
|
886
886
|
SFUHandler.prototype.cleanup = function (shouldStopTracks) {
|
|
887
887
|
if (shouldStopTracks === void 0) { shouldStopTracks = true; }
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
this.sendTransport
|
|
891
|
-
}
|
|
892
|
-
catch (err) {
|
|
893
|
-
}
|
|
894
|
-
this.sendTransport = undefined;
|
|
895
|
-
}
|
|
896
|
-
if (this.consumerTransport) {
|
|
897
|
-
try {
|
|
898
|
-
this.consumerTransport.close();
|
|
899
|
-
}
|
|
900
|
-
catch (err) {
|
|
901
|
-
}
|
|
902
|
-
this.consumerTransport = undefined;
|
|
903
|
-
}
|
|
904
|
-
if (this.producers) {
|
|
905
|
-
this.producers.forEach(function (producer) {
|
|
906
|
-
var _a;
|
|
907
|
-
try {
|
|
908
|
-
if (shouldStopTracks) {
|
|
909
|
-
try {
|
|
910
|
-
(_a = producer.track) === null || _a === void 0 ? void 0 : _a.stop();
|
|
911
|
-
}
|
|
912
|
-
catch (err) {
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
catch (err) {
|
|
917
|
-
}
|
|
918
|
-
if (producer.closed === false) {
|
|
888
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
889
|
+
return __generator(this, function (_a) {
|
|
890
|
+
if (this.sendTransport) {
|
|
919
891
|
try {
|
|
920
|
-
|
|
892
|
+
this.sendTransport.close();
|
|
921
893
|
}
|
|
922
894
|
catch (err) {
|
|
923
895
|
}
|
|
896
|
+
this.sendTransport = undefined;
|
|
924
897
|
}
|
|
925
|
-
|
|
926
|
-
}
|
|
927
|
-
this.dataProducers.forEach(function (producer) {
|
|
928
|
-
if (producer.closed === false) {
|
|
929
|
-
if (shouldStopTracks) {
|
|
898
|
+
if (this.consumerTransport) {
|
|
930
899
|
try {
|
|
931
|
-
|
|
900
|
+
this.consumerTransport.close();
|
|
932
901
|
}
|
|
933
902
|
catch (err) {
|
|
934
903
|
}
|
|
904
|
+
this.consumerTransport = undefined;
|
|
935
905
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
906
|
+
if (this.producers) {
|
|
907
|
+
this.producers.forEach(function (producer) {
|
|
908
|
+
var _a;
|
|
909
|
+
try {
|
|
910
|
+
if (shouldStopTracks) {
|
|
911
|
+
try {
|
|
912
|
+
(_a = producer.track) === null || _a === void 0 ? void 0 : _a.stop();
|
|
913
|
+
}
|
|
914
|
+
catch (err) {
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
catch (err) {
|
|
919
|
+
}
|
|
920
|
+
if (producer.closed === false) {
|
|
921
|
+
try {
|
|
922
|
+
producer.close();
|
|
923
|
+
}
|
|
924
|
+
catch (err) {
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
});
|
|
944
928
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
929
|
+
this.dataProducers.forEach(function (producer) {
|
|
930
|
+
if (producer.closed === false) {
|
|
931
|
+
if (shouldStopTracks) {
|
|
932
|
+
try {
|
|
933
|
+
producer.close();
|
|
934
|
+
}
|
|
935
|
+
catch (err) {
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
this.dataConsumer.forEach(function (consumer) {
|
|
941
|
+
if (consumer.closed === false) {
|
|
942
|
+
try {
|
|
943
|
+
consumer.close();
|
|
944
|
+
}
|
|
945
|
+
catch (err) {
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
this.consumers.forEach(function (consumer) {
|
|
950
|
+
var _a;
|
|
951
|
+
try {
|
|
952
|
+
(_a = consumer.track) === null || _a === void 0 ? void 0 : _a.stop();
|
|
953
|
+
}
|
|
954
|
+
catch (err) {
|
|
955
|
+
}
|
|
956
|
+
if (consumer.closed === false) {
|
|
957
|
+
consumer.close();
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
_super.prototype.cleanup.call(this);
|
|
961
|
+
return [2 /*return*/];
|
|
962
|
+
});
|
|
957
963
|
});
|
|
958
|
-
_super.prototype.cleanup.call(this);
|
|
959
964
|
};
|
|
960
965
|
return SFUHandler;
|
|
961
966
|
}(BaseVideoCallHandler));
|
|
@@ -88,7 +88,7 @@ export declare class WebsocketHandler extends Base {
|
|
|
88
88
|
private pongData;
|
|
89
89
|
private lastPingTimeStamp;
|
|
90
90
|
protected onObjectCreated(): void;
|
|
91
|
-
cleanup(): void
|
|
91
|
+
cleanup(): Promise<void>;
|
|
92
92
|
startSocketConnection(): Promise<void>;
|
|
93
93
|
private connect;
|
|
94
94
|
isWebScoketConnected(): boolean;
|
|
@@ -163,28 +163,34 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
163
163
|
};
|
|
164
164
|
WebsocketHandler.prototype.cleanup = function () {
|
|
165
165
|
var _a;
|
|
166
|
-
|
|
167
|
-
var data
|
|
168
|
-
this
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
166
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
+
var data;
|
|
168
|
+
return __generator(this, function (_b) {
|
|
169
|
+
try {
|
|
170
|
+
data = { userId: (_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId };
|
|
171
|
+
this.sendSocketMessage(WebSocketBasicEvents.SelfLeft, data);
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
}
|
|
175
|
+
this.loadBalancerIpAddressForWebSocket = undefined;
|
|
176
|
+
this.isEnded = true;
|
|
177
|
+
if (this.wss) {
|
|
178
|
+
this.wss.close();
|
|
179
|
+
this.wss = undefined;
|
|
180
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("this.wss undefined cleanup ");
|
|
181
|
+
}
|
|
182
|
+
if (this.socketCheckTimeout) {
|
|
183
|
+
window.clearTimeout(this.socketCheckTimeout);
|
|
184
|
+
this.socketCheckTimeout = undefined;
|
|
185
|
+
}
|
|
186
|
+
if (this.pingCheckTimeout) {
|
|
187
|
+
window.clearTimeout(this.pingCheckTimeout);
|
|
188
|
+
this.pingCheckTimeout = undefined;
|
|
189
|
+
}
|
|
190
|
+
_super.prototype.cleanup.call(this);
|
|
191
|
+
return [2 /*return*/];
|
|
192
|
+
});
|
|
193
|
+
});
|
|
188
194
|
};
|
|
189
195
|
WebsocketHandler.prototype.startSocketConnection = function () {
|
|
190
196
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -271,10 +277,15 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
271
277
|
this.wss.onerror = function (event) {
|
|
272
278
|
var _a;
|
|
273
279
|
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("wss error", event);
|
|
274
|
-
_this.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
if (_this.meetingStartRequest.isMobileApp) {
|
|
281
|
+
_this.communicationHandler.onIceCandidateDisconnected();
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
_this.isWebSocketConnectionInProgress = false;
|
|
285
|
+
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnSocketError, event);
|
|
286
|
+
if (_this.wss) {
|
|
287
|
+
_this.wss.close();
|
|
288
|
+
}
|
|
278
289
|
}
|
|
279
290
|
};
|
|
280
291
|
this.wss.onclose = function (event) {
|