vani-meeting-client 1.2.3 → 1.2.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.
|
@@ -54,7 +54,7 @@ export declare class CommunicationHandler {
|
|
|
54
54
|
onVideoBlocked(data: any): void;
|
|
55
55
|
onVideoUnblocked(data: any): void;
|
|
56
56
|
onIceCandidateDisconnected(): void;
|
|
57
|
-
|
|
57
|
+
checkIfInternetReachable: (count: number) => void;
|
|
58
58
|
private onApiResponded;
|
|
59
59
|
cleanup(): void;
|
|
60
60
|
}
|
|
@@ -43,12 +43,46 @@ import { VaniEventListener } from "../utility/VaniEventListener";
|
|
|
43
43
|
import { Utility } from "../utility/Utility";
|
|
44
44
|
var CommunicationHandler = /** @class */ (function () {
|
|
45
45
|
function CommunicationHandler(meetingHandler) {
|
|
46
|
+
var _this = this;
|
|
46
47
|
this.isStartAndSetupWithServerCalled = false;
|
|
47
48
|
this.eventEmitter = new VaniEventListener();
|
|
48
49
|
this.allParticipants = [];
|
|
49
50
|
this.selfTracks = [];
|
|
50
51
|
this.allTracks = [];
|
|
51
52
|
this.isReachable = true;
|
|
53
|
+
this.checkIfInternetReachable = function (count) {
|
|
54
|
+
var _a;
|
|
55
|
+
console.log("checkIfInternetReachable pre", _this.meetingStartRequest);
|
|
56
|
+
if (!_this.meetingStartRequest) {
|
|
57
|
+
(_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (count === 2) {
|
|
61
|
+
_this.emitMessageToSource(VaniEvent.OnNotReachable, {});
|
|
62
|
+
}
|
|
63
|
+
_this.isReachable = false;
|
|
64
|
+
console.log("checkIfInternetReachable");
|
|
65
|
+
fetch(_this.meetingStartRequest.urlToCheckInternetPresent, {
|
|
66
|
+
method: 'GET',
|
|
67
|
+
mode: 'no-cors',
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json',
|
|
70
|
+
}
|
|
71
|
+
}).then(function (response) { return response.text(); })
|
|
72
|
+
.then(function (data) { return _this.onApiResponded(count); })
|
|
73
|
+
.catch(function (error) {
|
|
74
|
+
var _a;
|
|
75
|
+
count = count + 1;
|
|
76
|
+
console.error('Error:', error);
|
|
77
|
+
if (count > 35) {
|
|
78
|
+
_this.emitMessageToSource(VaniEvent.OnReconectionTimeout, {});
|
|
79
|
+
(_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
_this.internetReachbilityTimeout = window.setTimeout(_this.checkIfInternetReachable, 1000, count);
|
|
83
|
+
});
|
|
84
|
+
;
|
|
85
|
+
};
|
|
52
86
|
this.meetingHandler = meetingHandler;
|
|
53
87
|
this.eventEmitter.setMaxListeners(100000);
|
|
54
88
|
}
|
|
@@ -419,40 +453,6 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
419
453
|
}
|
|
420
454
|
this.internetReachbilityTimeout = window.setTimeout(this.checkIfInternetReachable, 200, 0);
|
|
421
455
|
};
|
|
422
|
-
CommunicationHandler.prototype.checkIfInternetReachable = function (count) {
|
|
423
|
-
var _this = this;
|
|
424
|
-
var _a;
|
|
425
|
-
console.log("checkIfInternetReachable pre", count);
|
|
426
|
-
if (!this.meetingStartRequest) {
|
|
427
|
-
(_a = this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
if (count === 2) {
|
|
431
|
-
this.emitMessageToSource(VaniEvent.OnNotReachable, {});
|
|
432
|
-
}
|
|
433
|
-
this.isReachable = false;
|
|
434
|
-
console.log("checkIfInternetReachable");
|
|
435
|
-
fetch(this.meetingStartRequest.urlToCheckInternetPresent, {
|
|
436
|
-
method: 'GET',
|
|
437
|
-
mode: 'no-cors',
|
|
438
|
-
headers: {
|
|
439
|
-
'Content-Type': 'application/json',
|
|
440
|
-
}
|
|
441
|
-
}).then(function (response) { return response.text(); })
|
|
442
|
-
.then(function (data) { return _this.onApiResponded(count); })
|
|
443
|
-
.catch(function (error) {
|
|
444
|
-
var _a;
|
|
445
|
-
count = count + 1;
|
|
446
|
-
console.error('Error:', error);
|
|
447
|
-
if (count > 35) {
|
|
448
|
-
_this.emitMessageToSource(VaniEvent.OnReconectionTimeout, {});
|
|
449
|
-
(_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
_this.internetReachbilityTimeout = window.setTimeout(_this.checkIfInternetReachable, 1000, count);
|
|
453
|
-
});
|
|
454
|
-
;
|
|
455
|
-
};
|
|
456
456
|
CommunicationHandler.prototype.onApiResponded = function (count) {
|
|
457
457
|
var _a, _b, _c;
|
|
458
458
|
console.log("onApiResponded", count);
|