vani-meeting-client 1.6.3 → 1.6.5
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 +2 -2
- package/lib/inter-communication-handler/CommunicationHandler.js +11 -11
- package/lib/model/MeetingStartRequest.d.ts +5 -2
- package/lib/model/MeetingStartRequest.js +6 -1
- package/lib/user-media-handler/UserMediaHandler.js +3 -3
- package/lib/video-call-handler/SFUHandler.js +22 -21
- package/lib/websocket-handler/WebsocketHandler.js +13 -11
- package/package.json +1 -1
package/lib/MeetingHandler.js
CHANGED
|
@@ -34,7 +34,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
import { VaniEvent, MeetingStartRequest, ChatSendVia, MeetingType } from ".";
|
|
37
|
+
import { VaniEvent, MeetingStartRequest, ChatSendVia, MeetingType, LogLevel } from ".";
|
|
38
38
|
import { DynamicLibHelper } from "./utility/DynamicLibHelper";
|
|
39
39
|
import * as log from 'loglevel';
|
|
40
40
|
import { SFUMessageType, WebSocketBasicEvents, WebsocketHandler } from "./websocket-handler/WebsocketHandler";
|
|
@@ -308,7 +308,7 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
308
308
|
var oldParticipant = this.participantByUserId(participant.userId);
|
|
309
309
|
if (oldParticipant) {
|
|
310
310
|
oldParticipant = Object.assign(oldParticipant, participant);
|
|
311
|
-
console.log("updateParticipantData", oldParticipant);
|
|
311
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("updateParticipantData", oldParticipant);
|
|
312
312
|
(_a = this.websocketCallHandler) === null || _a === void 0 ? void 0 : _a.sendSocketMessage(WebSocketBasicEvents.UpdateParticipant, oldParticipant);
|
|
313
313
|
}
|
|
314
314
|
return oldParticipant;
|
|
@@ -34,7 +34,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
import { VaniEvent, MessagePayload } from "..";
|
|
37
|
+
import { VaniEvent, MessagePayload, LogLevel } from "..";
|
|
38
38
|
import { Participant } from "../model/Participant";
|
|
39
39
|
import * as log from 'loglevel';
|
|
40
40
|
import { Track, TrackKind } from "../model/Track";
|
|
@@ -64,7 +64,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
64
64
|
};
|
|
65
65
|
this.checkIfInternetReachable = function (count) {
|
|
66
66
|
var _a;
|
|
67
|
-
console.log("checkIfInternetReachable pre", _this.meetingStartRequest);
|
|
67
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("checkIfInternetReachable pre", _this.meetingStartRequest);
|
|
68
68
|
if (!_this.meetingStartRequest) {
|
|
69
69
|
(_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
70
70
|
return;
|
|
@@ -73,7 +73,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
73
73
|
_this.emitMessageToSource(VaniEvent.OnNotReachable, {});
|
|
74
74
|
}
|
|
75
75
|
_this.isReachable = false;
|
|
76
|
-
console.log("checkIfInternetReachable");
|
|
76
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("checkIfInternetReachable");
|
|
77
77
|
fetch(_this.meetingStartRequest.urlToCheckInternetPresent, {
|
|
78
78
|
method: 'GET',
|
|
79
79
|
mode: 'no-cors',
|
|
@@ -85,7 +85,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
85
85
|
.catch(function (error) {
|
|
86
86
|
var _a;
|
|
87
87
|
count = count + 1;
|
|
88
|
-
console.error('Error:', error);
|
|
88
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.error('Error:', error);
|
|
89
89
|
if (_this.meetingStartRequest) {
|
|
90
90
|
if (_this.meetingStartRequest.shouldKeepTryToReconnect === false && count > 35) {
|
|
91
91
|
_this.emitMessageToSource(VaniEvent.OnReconectionTimeout, {});
|
|
@@ -181,14 +181,14 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
181
181
|
CommunicationHandler.prototype.addParticipantIfNotExist = function (participant, shouldInfrom) {
|
|
182
182
|
var _a, _b, _c;
|
|
183
183
|
if (shouldInfrom === void 0) { shouldInfrom = false; }
|
|
184
|
-
console.log("addParticipantIfNotExist", this.allParticipants);
|
|
185
|
-
console.log("addParticipantIfNotExist new user", participant);
|
|
184
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("addParticipantIfNotExist", this.allParticipants);
|
|
185
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("addParticipantIfNotExist new user", participant);
|
|
186
186
|
var oldParticipant = this.participantByUserId(participant.userId);
|
|
187
187
|
if (oldParticipant) {
|
|
188
|
-
console.log("Old participant", oldParticipant);
|
|
189
|
-
console.log("new participant", participant);
|
|
188
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Old participant", oldParticipant);
|
|
189
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("new participant", participant);
|
|
190
190
|
oldParticipant = Object.assign(oldParticipant, participant);
|
|
191
|
-
console.log("Old participant after update", oldParticipant);
|
|
191
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Old participant after update", oldParticipant);
|
|
192
192
|
if (shouldInfrom) {
|
|
193
193
|
this.emitMessageToSource(VaniEvent.OnParticipantDataUpdated, oldParticipant);
|
|
194
194
|
}
|
|
@@ -480,7 +480,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
480
480
|
}
|
|
481
481
|
};
|
|
482
482
|
CommunicationHandler.prototype.onIceCandidateDisconnected = function () {
|
|
483
|
-
console.log("onIceCandidateDisconnected", this.internetReachbilityTimeout);
|
|
483
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onIceCandidateDisconnected", this.internetReachbilityTimeout);
|
|
484
484
|
if (this.internetReachbilityTimeout) {
|
|
485
485
|
return;
|
|
486
486
|
}
|
|
@@ -488,7 +488,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
488
488
|
};
|
|
489
489
|
CommunicationHandler.prototype.onApiResponded = function (count) {
|
|
490
490
|
var _a;
|
|
491
|
-
console.log("onApiResponded", count);
|
|
491
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onApiResponded", count);
|
|
492
492
|
if (this.isReachable === false) {
|
|
493
493
|
this.isReachable = true;
|
|
494
494
|
this.internetReachbilityTimeout = undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LogLevelDesc } from "loglevel";
|
|
2
1
|
export declare enum MeetingType {
|
|
3
2
|
CHAT = "chat",
|
|
4
3
|
WEBRTC = "webrtc",
|
|
@@ -12,6 +11,10 @@ export declare enum CameraFacingMode {
|
|
|
12
11
|
Front = "user",
|
|
13
12
|
Back = "environment"
|
|
14
13
|
}
|
|
14
|
+
export declare enum LogLevel {
|
|
15
|
+
None = "none",
|
|
16
|
+
Debug = "Debug"
|
|
17
|
+
}
|
|
15
18
|
export declare class MeetingStartRequest {
|
|
16
19
|
roomId: string;
|
|
17
20
|
userId: string;
|
|
@@ -31,7 +34,7 @@ export declare class MeetingStartRequest {
|
|
|
31
34
|
minBitrateConfig: number;
|
|
32
35
|
maxBitRateConfig: number;
|
|
33
36
|
maxAudioBitrateConfig: number;
|
|
34
|
-
logLevel:
|
|
37
|
+
logLevel: LogLevel;
|
|
35
38
|
dynamicWebSocketFetchBaseUrl?: string;
|
|
36
39
|
isRecordingUser: boolean;
|
|
37
40
|
meetingType: MeetingType;
|
|
@@ -14,6 +14,11 @@ export var CameraFacingMode;
|
|
|
14
14
|
CameraFacingMode["Front"] = "user";
|
|
15
15
|
CameraFacingMode["Back"] = "environment";
|
|
16
16
|
})(CameraFacingMode || (CameraFacingMode = {}));
|
|
17
|
+
export var LogLevel;
|
|
18
|
+
(function (LogLevel) {
|
|
19
|
+
LogLevel["None"] = "none";
|
|
20
|
+
LogLevel["Debug"] = "Debug";
|
|
21
|
+
})(LogLevel || (LogLevel = {}));
|
|
17
22
|
var MeetingStartRequest = /** @class */ (function () {
|
|
18
23
|
function MeetingStartRequest(_roomId, _userId, _appId, _wssUrl) {
|
|
19
24
|
this.videoCaptureWidth = 0;
|
|
@@ -28,7 +33,7 @@ var MeetingStartRequest = /** @class */ (function () {
|
|
|
28
33
|
this.minBitrateConfig = 40000;
|
|
29
34
|
this.maxBitRateConfig = 620000;
|
|
30
35
|
this.maxAudioBitrateConfig = -1;
|
|
31
|
-
this.logLevel =
|
|
36
|
+
this.logLevel = LogLevel.None;
|
|
32
37
|
this.isRecordingUser = false;
|
|
33
38
|
this.meetingType = MeetingType.SFU;
|
|
34
39
|
this.defaultAudioBlocked = false;
|
|
@@ -50,7 +50,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
import log from 'loglevel';
|
|
53
|
-
import { CameraFacingMode, VaniEvent } from "..";
|
|
53
|
+
import { CameraFacingMode, LogLevel, VaniEvent } from "..";
|
|
54
54
|
import { Base } from "../base/Base";
|
|
55
55
|
import { Track, TrackKind } from "../model/Track";
|
|
56
56
|
import { DynamicLibHelper } from "../utility/DynamicLibHelper";
|
|
@@ -481,7 +481,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
481
481
|
resolve({ message: "No Video In Devices", error: 'NoDevice', isSuccess: false });
|
|
482
482
|
return [2 /*return*/];
|
|
483
483
|
}
|
|
484
|
-
console.log("pauseCamera UserMediaHandler");
|
|
484
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("pauseCamera UserMediaHandler");
|
|
485
485
|
track = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfTrackByType(TrackKind.Video);
|
|
486
486
|
if (track) {
|
|
487
487
|
if (track.track) {
|
|
@@ -544,7 +544,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
544
544
|
resolve({ message: "No Audio In Devices", error: 'NoDevice', isSuccess: false });
|
|
545
545
|
return [2 /*return*/];
|
|
546
546
|
}
|
|
547
|
-
console.log("muteUser UserMediaHandler");
|
|
547
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("muteUser UserMediaHandler");
|
|
548
548
|
track = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfTrackByType(TrackKind.Audio);
|
|
549
549
|
if (track) {
|
|
550
550
|
if (track.track) {
|
|
@@ -65,7 +65,7 @@ import { BaseVideoCallHandler } from "./BaseVideoCallHandler";
|
|
|
65
65
|
import { detectDevice, Device } from 'mediasoup-client';
|
|
66
66
|
import { SFUMessageType } from "../websocket-handler/WebsocketHandler";
|
|
67
67
|
import { Track, TrackKind } from "../model/Track";
|
|
68
|
-
import { VaniEvent } from '..';
|
|
68
|
+
import { LogLevel, VaniEvent } from '..';
|
|
69
69
|
var SFUHandler = /** @class */ (function (_super) {
|
|
70
70
|
__extends(SFUHandler, _super);
|
|
71
71
|
function SFUHandler(_meetingStartRequest, _communicationHandler) {
|
|
@@ -80,18 +80,18 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
80
80
|
var handlerName = detectDevice();
|
|
81
81
|
if (handlerName) {
|
|
82
82
|
_this.device = new Device();
|
|
83
|
-
console.log("detected handler: %s", handlerName);
|
|
83
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("detected handler: %s", handlerName);
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
86
|
if (_this.meetingStartRequest && _this.meetingStartRequest.mediasoupDeviceHandlerName) {
|
|
87
87
|
_this.device = new Device({ handlerName: _this.meetingStartRequest.mediasoupDeviceHandlerName });
|
|
88
88
|
}
|
|
89
|
-
console.warn("no suitable handler found for current browser/device");
|
|
89
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.warn("no suitable handler found for current browser/device");
|
|
90
90
|
}
|
|
91
91
|
return _this;
|
|
92
92
|
}
|
|
93
93
|
SFUHandler.prototype.reconnectedWithoutPing = function () {
|
|
94
|
-
console.log("reconnectedWithoutPing");
|
|
94
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("reconnectedWithoutPing");
|
|
95
95
|
this.onReconnect();
|
|
96
96
|
};
|
|
97
97
|
SFUHandler.prototype.onReconnect = function () {
|
|
@@ -124,14 +124,14 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
124
124
|
iceParameters = data.message.iceParameters;
|
|
125
125
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.downloadParticipantsData();
|
|
126
126
|
if (!(this.consumerTransport && this.consumerTransport.id === transportId)) return [3 /*break*/, 2];
|
|
127
|
-
console.log("Restat Ice consumer");
|
|
127
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Restat Ice consumer");
|
|
128
128
|
return [4 /*yield*/, this.consumerTransport.restartIce({ iceParameters: iceParameters })];
|
|
129
129
|
case 1:
|
|
130
130
|
_b.sent();
|
|
131
131
|
return [3 /*break*/, 4];
|
|
132
132
|
case 2:
|
|
133
133
|
if (!(this.sendTransport && this.sendTransport.id === transportId)) return [3 /*break*/, 4];
|
|
134
|
-
console.log("Restat Ice sender");
|
|
134
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Restat Ice sender");
|
|
135
135
|
return [4 /*yield*/, this.sendTransport.restartIce({ iceParameters: iceParameters })];
|
|
136
136
|
case 3:
|
|
137
137
|
_b.sent();
|
|
@@ -153,10 +153,10 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
153
153
|
var messageJson = { to: "self", type: SFUMessageType.OnProducerClosed, message: { producerId: producer.id } };
|
|
154
154
|
this.sendSFUMessageToSocket(messageJson);
|
|
155
155
|
var index = this.producers.indexOf(producer);
|
|
156
|
-
console.log("stopTrack ", index);
|
|
156
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("stopTrack ", index);
|
|
157
157
|
if (index > -1) {
|
|
158
158
|
this.producers.splice(index, 1);
|
|
159
|
-
console.log("stopTrack producers", this.producers);
|
|
159
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("stopTrack producers", this.producers);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
};
|
|
@@ -182,7 +182,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
182
182
|
return __awaiter(this, void 0, void 0, function () {
|
|
183
183
|
var producer, consumer;
|
|
184
184
|
return __generator(this, function (_a) {
|
|
185
|
-
console.log("resumeProducerOrConsumerForTrack");
|
|
185
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("resumeProducerOrConsumerForTrack");
|
|
186
186
|
if (track.track) {
|
|
187
187
|
track.track.enabled = true;
|
|
188
188
|
}
|
|
@@ -204,7 +204,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
204
204
|
return __awaiter(this, void 0, void 0, function () {
|
|
205
205
|
var producer, consumer;
|
|
206
206
|
return __generator(this, function (_a) {
|
|
207
|
-
console.log("pauseProducerOrConsumerForTrack");
|
|
207
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("pauseProducerOrConsumerForTrack");
|
|
208
208
|
producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
|
|
209
209
|
if (producer) {
|
|
210
210
|
producer.pause();
|
|
@@ -264,6 +264,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
264
264
|
var _a, _b, _c, _d, _e;
|
|
265
265
|
return __awaiter(this, void 0, void 0, function () {
|
|
266
266
|
var producer, appData, producerData, webcamProducer;
|
|
267
|
+
var _this = this;
|
|
267
268
|
return __generator(this, function (_f) {
|
|
268
269
|
switch (_f.label) {
|
|
269
270
|
case 0:
|
|
@@ -307,18 +308,18 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
307
308
|
case 3:
|
|
308
309
|
webcamProducer = _f.sent();
|
|
309
310
|
if (webcamProducer) {
|
|
310
|
-
console.log("On webcamProducer");
|
|
311
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On webcamProducer");
|
|
311
312
|
this.producers.push(webcamProducer);
|
|
312
313
|
if (webcamProducer) {
|
|
313
314
|
webcamProducer.observer.on("trackended", function () {
|
|
314
|
-
console.log("On Track Endded producer event");
|
|
315
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On Track Endded producer event");
|
|
315
316
|
});
|
|
316
317
|
}
|
|
317
318
|
this.onParticipantUpdated();
|
|
318
319
|
// this.sendMessageReadyToConsume();
|
|
319
320
|
}
|
|
320
321
|
else {
|
|
321
|
-
console.log("On webcamProducer not created");
|
|
322
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On webcamProducer not created");
|
|
322
323
|
}
|
|
323
324
|
_f.label = 4;
|
|
324
325
|
case 4: return [2 /*return*/];
|
|
@@ -447,7 +448,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
447
448
|
var allProducers;
|
|
448
449
|
var _this = this;
|
|
449
450
|
return __generator(this, function (_a) {
|
|
450
|
-
console.log("onAllProducers");
|
|
451
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onAllProducers");
|
|
451
452
|
if (this.consumerTransport) {
|
|
452
453
|
allProducers = data.message.producers;
|
|
453
454
|
allProducers.forEach(function (eachProducer) {
|
|
@@ -495,7 +496,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
495
496
|
this.sendTransport = this.device.createSendTransport(transport);
|
|
496
497
|
this.sendTransport.on('produce', function (producerLocalParameters, callback, errback) {
|
|
497
498
|
var _a;
|
|
498
|
-
console.log(" onSendTransport produce");
|
|
499
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log(" onSendTransport produce");
|
|
499
500
|
_this.transportCallBacks[producerLocalParameters.appData.trackId] = callback;
|
|
500
501
|
var messageJson = { to: "self", type: SFUMessageType.OnTransportProduceSyncRequest, message: { type: producerLocalParameters.appData.type, transportId: (_a = _this.sendTransport) === null || _a === void 0 ? void 0 : _a.id, kind: producerLocalParameters.kind, rtpParameters: producerLocalParameters.rtpParameters, appData: producerLocalParameters.appData } };
|
|
501
502
|
_this.sendSFUMessageToSocket(messageJson);
|
|
@@ -512,7 +513,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
512
513
|
}); });
|
|
513
514
|
this.sendTransport.on('connectionstatechange', function (newState) {
|
|
514
515
|
var _a;
|
|
515
|
-
console.log("connectionstatechange sendTransport ", newState);
|
|
516
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("connectionstatechange sendTransport ", newState);
|
|
516
517
|
if (newState === "disconnected" || newState === "failed") {
|
|
517
518
|
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.onIceCandidateDisconnected();
|
|
518
519
|
}
|
|
@@ -527,7 +528,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
527
528
|
this.consumerTransport = this.device.createRecvTransport(transport);
|
|
528
529
|
this.consumerTransport.on("connectionstatechange", function (newState) {
|
|
529
530
|
var _a;
|
|
530
|
-
console.log("connectionstatechange consumerTransport ", newState);
|
|
531
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("connectionstatechange consumerTransport ", newState);
|
|
531
532
|
if (newState === "disconnected" || newState === "failed") {
|
|
532
533
|
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.onIceCandidateDisconnected();
|
|
533
534
|
}
|
|
@@ -645,8 +646,8 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
645
646
|
return __awaiter(this, void 0, void 0, function () {
|
|
646
647
|
var producer, producerId, consumerAppData, cosumeObj, message;
|
|
647
648
|
return __generator(this, function (_a) {
|
|
648
|
-
// console.log("onNewProducer")
|
|
649
|
-
// console.log(data)
|
|
649
|
+
// this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onNewProducer")
|
|
650
|
+
// this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log(data)
|
|
650
651
|
if (this.consumerTransport && data && data.message && data.message.producer) {
|
|
651
652
|
producer = data.message.producer;
|
|
652
653
|
producerId = producer.id;
|
|
@@ -684,7 +685,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
684
685
|
if (message && message.message) {
|
|
685
686
|
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.onMessage(message.message);
|
|
686
687
|
}
|
|
687
|
-
// console.log("OnMessage Data Channel", message)
|
|
688
|
+
// this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("OnMessage Data Channel", message)
|
|
688
689
|
});
|
|
689
690
|
});
|
|
690
691
|
}
|
|
@@ -693,7 +694,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
693
694
|
this.consumerTransport.consume(consumerObj).then(function (consumer) {
|
|
694
695
|
var _a, _b, _c;
|
|
695
696
|
consumer.observer.on("trackended", function () {
|
|
696
|
-
console.log("Consumer track Endded observer");
|
|
697
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Consumer track Endded observer");
|
|
697
698
|
});
|
|
698
699
|
_this.consumers.push(consumer);
|
|
699
700
|
var mediaTrack = consumer.track;
|
|
@@ -50,7 +50,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
import axios from 'axios';
|
|
53
|
-
import { MeetingType, VaniEvent } from '..';
|
|
53
|
+
import { LogLevel, MeetingType, VaniEvent } from '..';
|
|
54
54
|
import { Base } from '../base/Base';
|
|
55
55
|
import * as log from 'loglevel';
|
|
56
56
|
export var WebSocketBasicEvents;
|
|
@@ -166,7 +166,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
166
166
|
if (this.wss) {
|
|
167
167
|
this.wss.close();
|
|
168
168
|
this.wss = undefined;
|
|
169
|
-
console.log("this.wss undefined cleanup ");
|
|
169
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("this.wss undefined cleanup ");
|
|
170
170
|
}
|
|
171
171
|
if (this.socketCheckTimeout) {
|
|
172
172
|
window.clearTimeout(this.socketCheckTimeout);
|
|
@@ -261,7 +261,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
261
261
|
};
|
|
262
262
|
this.wss.onerror = function (event) {
|
|
263
263
|
var _a;
|
|
264
|
-
console.log("wss error", event);
|
|
264
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("wss error", event);
|
|
265
265
|
_this.isWebSocketConnectionInProgress = false;
|
|
266
266
|
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnSocketError, event);
|
|
267
267
|
if (_this.wss) {
|
|
@@ -288,7 +288,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
288
288
|
if (this.wss && this.wss.readyState === 1) {
|
|
289
289
|
return true;
|
|
290
290
|
}
|
|
291
|
-
console.log("this.wss.readyState", this.wss, (_a = this.wss) === null || _a === void 0 ? void 0 : _a.readyState);
|
|
291
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("this.wss.readyState", this.wss, (_a = this.wss) === null || _a === void 0 ? void 0 : _a.readyState);
|
|
292
292
|
return false;
|
|
293
293
|
};
|
|
294
294
|
WebsocketHandler.prototype.sendSocketMessage = function (type, data) {
|
|
@@ -305,7 +305,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
305
305
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnReconecting, {});
|
|
306
306
|
this.wss.close(3005);
|
|
307
307
|
this.wss = undefined;
|
|
308
|
-
console.log("this.wss undefined reconnectOnInternetFailur ");
|
|
308
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("this.wss undefined reconnectOnInternetFailur ");
|
|
309
309
|
}
|
|
310
310
|
this.connection = ConnectionType.reconnect;
|
|
311
311
|
this.connect(true);
|
|
@@ -385,17 +385,19 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
385
385
|
this.sendSocketMessage(WebSocketBasicEvents.IsSetupDone, checkIfSetupDone);
|
|
386
386
|
log.info("Vani setupDone asked");
|
|
387
387
|
window.setTimeout(function () {
|
|
388
|
-
|
|
388
|
+
var _a;
|
|
389
|
+
if (_this.isSetUpDone || _this.setUpTry > 15) {
|
|
390
|
+
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnSocketError, {});
|
|
389
391
|
return;
|
|
390
392
|
}
|
|
391
393
|
_this.askIfSetupDone();
|
|
392
394
|
_this.setUpTry = _this.setUpTry + 1;
|
|
393
|
-
},
|
|
395
|
+
}, 300);
|
|
394
396
|
};
|
|
395
397
|
WebsocketHandler.prototype.onMessage = function (message) {
|
|
396
398
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
397
399
|
this.lastPingTimeStamp = new Date().getTime();
|
|
398
|
-
// console.log("lastPingTimeStamp time ", this.lastPingTimeStamp)
|
|
400
|
+
// this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("lastPingTimeStamp time ", this.lastPingTimeStamp)
|
|
399
401
|
var messagejson = JSON.parse(message);
|
|
400
402
|
if (messagejson.type && messagejson.data) {
|
|
401
403
|
var type = messagejson.type;
|
|
@@ -419,7 +421,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
419
421
|
}
|
|
420
422
|
else if (type === WebSocketBasicEvents.OnNewJoinee || type === WebSocketBasicEvents.OnRejoined) {
|
|
421
423
|
if (data && data.message && data.message.participant) {
|
|
422
|
-
console.log("OnParticipantUpdated from server", data.message.participant);
|
|
424
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("OnParticipantUpdated from server", data.message.participant);
|
|
423
425
|
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.addParticipantIfNotExist(data.message.participant, true);
|
|
424
426
|
}
|
|
425
427
|
}
|
|
@@ -470,7 +472,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
470
472
|
};
|
|
471
473
|
WebsocketHandler.prototype.onSetupDone = function (data) {
|
|
472
474
|
var _a, _b, _c;
|
|
473
|
-
console.log("onSetupDone", this.meetingStartRequest);
|
|
475
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onSetupDone", this.meetingStartRequest);
|
|
474
476
|
if (!this.meetingStartRequest) {
|
|
475
477
|
return;
|
|
476
478
|
}
|
|
@@ -504,7 +506,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
504
506
|
}
|
|
505
507
|
if ((this.lastPingTimeStamp + (80 * 1000)) < new Date().getTime()) {
|
|
506
508
|
this.pingCheckTimeout = undefined;
|
|
507
|
-
console.log("checkIfPingIsRunning", this.lastPingTimeStamp);
|
|
509
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("checkIfPingIsRunning", this.lastPingTimeStamp);
|
|
508
510
|
//Discounted
|
|
509
511
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.onIceCandidateDisconnected();
|
|
510
512
|
(_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.emitMessageToSource(VaniEvent.OnNotReachable, {});
|