vani-meeting-client 1.2.2 → 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
|
}
|
|
@@ -413,44 +447,12 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
413
447
|
};
|
|
414
448
|
//Connection Recheck
|
|
415
449
|
CommunicationHandler.prototype.onIceCandidateDisconnected = function () {
|
|
450
|
+
console.log("onIceCandidateDisconnected", this.internetReachbilityTimeout);
|
|
416
451
|
if (this.internetReachbilityTimeout) {
|
|
417
452
|
return;
|
|
418
453
|
}
|
|
419
454
|
this.internetReachbilityTimeout = window.setTimeout(this.checkIfInternetReachable, 200, 0);
|
|
420
455
|
};
|
|
421
|
-
CommunicationHandler.prototype.checkIfInternetReachable = function (count) {
|
|
422
|
-
var _this = this;
|
|
423
|
-
var _a;
|
|
424
|
-
if (!this.meetingStartRequest) {
|
|
425
|
-
(_a = this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
if (count === 2) {
|
|
429
|
-
this.emitMessageToSource(VaniEvent.OnNotReachable, {});
|
|
430
|
-
}
|
|
431
|
-
this.isReachable = false;
|
|
432
|
-
console.log("checkIfInternetReachable");
|
|
433
|
-
fetch(this.meetingStartRequest.urlToCheckInternetPresent, {
|
|
434
|
-
method: 'GET',
|
|
435
|
-
mode: 'no-cors',
|
|
436
|
-
headers: {
|
|
437
|
-
'Content-Type': 'application/json',
|
|
438
|
-
}
|
|
439
|
-
}).then(function (response) { return response.text(); })
|
|
440
|
-
.then(function (data) { return _this.onApiResponded(count); })
|
|
441
|
-
.catch(function (error) {
|
|
442
|
-
var _a;
|
|
443
|
-
count = count + 1;
|
|
444
|
-
console.error('Error:', error);
|
|
445
|
-
if (count > 35) {
|
|
446
|
-
_this.emitMessageToSource(VaniEvent.OnReconectionTimeout, {});
|
|
447
|
-
(_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
_this.internetReachbilityTimeout = window.setTimeout(_this.checkIfInternetReachable, 1000, count);
|
|
451
|
-
});
|
|
452
|
-
;
|
|
453
|
-
};
|
|
454
456
|
CommunicationHandler.prototype.onApiResponded = function (count) {
|
|
455
457
|
var _a, _b, _c;
|
|
456
458
|
console.log("onApiResponded", count);
|