vani-meeting-client-native 0.0.8 → 0.1.0
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.d.ts +5 -4
- package/lib/MeetingHandler.js +45 -20
- 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 +3 -0
- package/lib/model/Event.js +1 -0
- package/lib/model/MeetingStartRequest.d.ts +1 -0
- package/lib/model/MeetingStartRequest.js +1 -0
- package/lib/user-media-handler/UserMediaHandler.d.ts +1 -1
- package/lib/user-media-handler/UserMediaHandler.js +107 -75
- 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 +70 -41
- package/lib/websocket-handler/WebsocketHandler.d.ts +1 -1
- package/lib/websocket-handler/WebsocketHandler.js +48 -31
- package/package.json +1 -1
package/lib/MeetingHandler.d.ts
CHANGED
|
@@ -15,10 +15,10 @@ export declare class MeetingHandler {
|
|
|
15
15
|
meetingStartRequestObject(roomId: string, userId: string, appId: string, wssUrl: string, shouldIgnoreCaseForRoomId?: boolean): MeetingStartRequest;
|
|
16
16
|
endAndDestory(): void;
|
|
17
17
|
requestToCloseTheRoom: () => void;
|
|
18
|
-
init(): Promise<
|
|
18
|
+
init(): Promise<boolean>;
|
|
19
19
|
recreateVideoCallHandler: () => Promise<BaseVideoCallHandler>;
|
|
20
20
|
switchCamera(): void;
|
|
21
|
-
startLocalStream(isVideoRequired: boolean, isAudioRequired: boolean, shouldAddTrackImmediately?: boolean, userMediaPayload?: any): Promise<
|
|
21
|
+
startLocalStream(isVideoRequired: boolean, isAudioRequired: boolean, shouldAddTrackImmediately?: boolean, userMediaPayload?: any): Promise<boolean>;
|
|
22
22
|
startScreenShare(isAudioRequired?: boolean, shouldAddTrackImmediately?: boolean, screensharePayload?: any): Promise<void>;
|
|
23
23
|
stopScreenSharing(): Promise<void>;
|
|
24
24
|
getDevices(deviceType: GetDevicesType): Promise<Device[] | undefined>;
|
|
@@ -44,12 +44,13 @@ export declare class MeetingHandler {
|
|
|
44
44
|
getAllTracks(): Track[];
|
|
45
45
|
getTracksByParticipantId(participantId: string): Track[];
|
|
46
46
|
isWebScoketConnected(): boolean;
|
|
47
|
+
isStartMeetingCalled: () => void;
|
|
47
48
|
sendMessage(message: MessagePayload): TaskResponse;
|
|
48
49
|
getOldMessages(): Promise<void>;
|
|
49
50
|
onOldMessages(data: any): Promise<void>;
|
|
50
|
-
checkSocket(): Promise<
|
|
51
|
+
checkSocket(): Promise<boolean>;
|
|
51
52
|
startMeeting(): Promise<void>;
|
|
52
|
-
getMeetingStartTime(): Promise<
|
|
53
|
+
getMeetingStartTime(): Promise<boolean>;
|
|
53
54
|
startRTMPStream(urls: string[]): Promise<void>;
|
|
54
55
|
getEventEmitter(): VaniEventListener | undefined;
|
|
55
56
|
restartTransport: () => Promise<void>;
|
package/lib/MeetingHandler.js
CHANGED
|
@@ -78,6 +78,10 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
}); };
|
|
81
|
+
this.isStartMeetingCalled = function () {
|
|
82
|
+
var _a;
|
|
83
|
+
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.isStartAndSetupWithServerCalled;
|
|
84
|
+
};
|
|
81
85
|
this.restartTransport = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
82
86
|
var _a;
|
|
83
87
|
return __generator(this, function (_b) {
|
|
@@ -119,7 +123,7 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
119
123
|
case 0:
|
|
120
124
|
if (!this.meetingStartRequest) {
|
|
121
125
|
log.error("meetingStartRequestObject not found");
|
|
122
|
-
return [2 /*return
|
|
126
|
+
return [2 /*return*/, false];
|
|
123
127
|
}
|
|
124
128
|
log.setLevel("trace");
|
|
125
129
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.setMeetingStartRequest(this.meetingStartRequest);
|
|
@@ -143,7 +147,7 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
143
147
|
}
|
|
144
148
|
// this.handleGA();
|
|
145
149
|
this.emitMessageToSource(VaniEvent.OnInitDone, {});
|
|
146
|
-
return [2 /*return
|
|
150
|
+
return [2 /*return*/, true];
|
|
147
151
|
}
|
|
148
152
|
});
|
|
149
153
|
});
|
|
@@ -159,7 +163,7 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
159
163
|
return __generator(this, function (_c) {
|
|
160
164
|
if (!this.meetingStartRequest) {
|
|
161
165
|
log.error("meetingStartRequestObject not found");
|
|
162
|
-
return [2 /*return
|
|
166
|
+
return [2 /*return*/, false];
|
|
163
167
|
}
|
|
164
168
|
if ((((_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.isMobileApp) && !this.reactNativeWebrtcPlugin) || ((_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.isReady()) === false) {
|
|
165
169
|
log.error("Init method not called");
|
|
@@ -172,7 +176,7 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
172
176
|
return [2 /*return*/];
|
|
173
177
|
}
|
|
174
178
|
this.userMediaHandler.startLocalStream(isVideoRequired, isAudioRequired, shouldAddTrackImmediately, userMediaPayload);
|
|
175
|
-
return [2 /*return
|
|
179
|
+
return [2 /*return*/, true];
|
|
176
180
|
});
|
|
177
181
|
});
|
|
178
182
|
};
|
|
@@ -448,15 +452,15 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
448
452
|
return __generator(this, function (_a) {
|
|
449
453
|
if (!this.meetingStartRequest) {
|
|
450
454
|
log.error("meetingStartRequestObject not found");
|
|
451
|
-
return [2 /*return
|
|
455
|
+
return [2 /*return*/, false];
|
|
452
456
|
}
|
|
453
457
|
if (!this.websocketCallHandler) {
|
|
454
458
|
log.error("Init method not called");
|
|
455
|
-
return [2 /*return
|
|
459
|
+
return [2 /*return*/, false];
|
|
456
460
|
}
|
|
457
461
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("checkSocket");
|
|
458
462
|
this.websocketCallHandler.startSocketConnection();
|
|
459
|
-
return [2 /*return
|
|
463
|
+
return [2 /*return*/, true];
|
|
460
464
|
});
|
|
461
465
|
});
|
|
462
466
|
};
|
|
@@ -476,15 +480,15 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
476
480
|
return __generator(this, function (_c) {
|
|
477
481
|
if (!this.meetingStartRequest) {
|
|
478
482
|
log.error("meetingStartRequestObject not found");
|
|
479
|
-
return [2 /*return
|
|
483
|
+
return [2 /*return*/, false];
|
|
480
484
|
}
|
|
481
485
|
if (!this.websocketCallHandler) {
|
|
482
486
|
log.error("Init method not called");
|
|
483
|
-
return [2 /*return
|
|
487
|
+
return [2 /*return*/, false];
|
|
484
488
|
}
|
|
485
489
|
meetingStartTimeObject = { type: WebSocketBasicEvents.GetMeetingStartTime, to: (_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId };
|
|
486
490
|
(_b = this.websocketCallHandler) === null || _b === void 0 ? void 0 : _b.sendSocketMessage(WebSocketBasicEvents.GetMeetingStartTime, meetingStartTimeObject);
|
|
487
|
-
return [2 /*return
|
|
491
|
+
return [2 /*return*/, true];
|
|
488
492
|
});
|
|
489
493
|
});
|
|
490
494
|
};
|
|
@@ -516,16 +520,37 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
516
520
|
};
|
|
517
521
|
MeetingHandler.prototype.cleanup = function () {
|
|
518
522
|
var _a, _b, _c, _d;
|
|
519
|
-
this
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
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
|
+
});
|
|
529
554
|
};
|
|
530
555
|
MeetingHandler.prototype.handleGA = function () {
|
|
531
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 === 20) {
|
|
81
81
|
_this.emitMessageToSource(VaniEvent.OnNotReachable, {});
|
|
82
|
+
if (_this.meetingStartRequest && _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;
|
|
@@ -98,6 +100,7 @@ export declare interface VaniEventListener {
|
|
|
98
100
|
on<U extends keyof VaniConnectionEvents>(event: U, listener: VaniConnectionEvents[U]): this;
|
|
99
101
|
off<U extends keyof VaniConnectionEvents>(event: U, listener: VaniConnectionEvents[U]): this;
|
|
100
102
|
emit<U extends keyof VaniConnectionEvents>(event: U, ...args: Parameters<VaniConnectionEvents[U]>): boolean;
|
|
103
|
+
removeAllListeners(): this;
|
|
101
104
|
}
|
|
102
105
|
export interface Device {
|
|
103
106
|
id: string;
|
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";
|
|
@@ -50,6 +50,7 @@ export declare class MeetingStartRequest {
|
|
|
50
50
|
connectionProtocol: ConnectionProtocol;
|
|
51
51
|
shouldKeepTryToReconnect: boolean;
|
|
52
52
|
shouldIgnoreCaseForRoomId: boolean;
|
|
53
|
+
shouldUseExactDeviceForUserMedia: boolean;
|
|
53
54
|
urlToCheckInternetPresent: string;
|
|
54
55
|
constructor(_roomId: string, _userId: string, _appId: string, _wssUrl: string, _shouldIgnoreCaseForRoomId?: boolean);
|
|
55
56
|
}
|
|
@@ -48,6 +48,7 @@ var MeetingStartRequest = /** @class */ (function () {
|
|
|
48
48
|
this.connectionProtocol = ConnectionProtocol.UDP;
|
|
49
49
|
this.shouldKeepTryToReconnect = false;
|
|
50
50
|
this.shouldIgnoreCaseForRoomId = false;
|
|
51
|
+
this.shouldUseExactDeviceForUserMedia = false;
|
|
51
52
|
this.urlToCheckInternetPresent = "https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&titles=Stack%20Overflow";
|
|
52
53
|
this.shouldIgnoreCaseForRoomId = _shouldIgnoreCaseForRoomId;
|
|
53
54
|
if (this.shouldIgnoreCaseForRoomId) {
|
|
@@ -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
|
}
|
|
@@ -168,11 +168,11 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
168
168
|
var _this = this;
|
|
169
169
|
return __generator(this, function (_a) {
|
|
170
170
|
if (!this.meetingStartRequest) {
|
|
171
|
-
log.
|
|
171
|
+
log.log("meetingStartRequest not found");
|
|
172
172
|
return [2 /*return*/];
|
|
173
173
|
}
|
|
174
174
|
if (this.isScreenShareFetchInProgress) {
|
|
175
|
-
log.
|
|
175
|
+
log.log("Already fetching stream. So request ignored");
|
|
176
176
|
return [2 /*return*/];
|
|
177
177
|
}
|
|
178
178
|
if (!screensharePayload) {
|
|
@@ -209,7 +209,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
209
209
|
}
|
|
210
210
|
this.userMediaPayload = userMediaPayload;
|
|
211
211
|
if (this.isVideoAudioFetchInProgress) {
|
|
212
|
-
log.
|
|
212
|
+
log.log("Already fetching stream. So request ignored");
|
|
213
213
|
return [2 /*return*/];
|
|
214
214
|
}
|
|
215
215
|
if (!isVideoRequired) return [3 /*break*/, 2];
|
|
@@ -280,7 +280,12 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
280
280
|
userMediaPayload.video = this.getVideoDictionay();
|
|
281
281
|
}
|
|
282
282
|
if ((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.cameraDevice) {
|
|
283
|
-
|
|
283
|
+
if (this.meetingStartRequest.shouldUseExactDeviceForUserMedia) {
|
|
284
|
+
userMediaPayload.video.deviceId = { exact: this.meetingStartRequest.cameraDevice };
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
userMediaPayload.video.deviceId = this.meetingStartRequest.cameraDevice;
|
|
288
|
+
}
|
|
284
289
|
}
|
|
285
290
|
else {
|
|
286
291
|
if (!this.cameraFacingMode) {
|
|
@@ -298,7 +303,12 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
298
303
|
userMediaPayload.audio = this.getAudioDictionay();
|
|
299
304
|
}
|
|
300
305
|
if ((_e = this.meetingStartRequest) === null || _e === void 0 ? void 0 : _e.audioInDevice) {
|
|
301
|
-
|
|
306
|
+
if (this.meetingStartRequest.shouldUseExactDeviceForUserMedia) {
|
|
307
|
+
userMediaPayload.audio.deviceId = { exact: this.meetingStartRequest.audioInDevice };
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
userMediaPayload.audio.deviceId = this.meetingStartRequest.audioInDevice;
|
|
311
|
+
}
|
|
302
312
|
}
|
|
303
313
|
}
|
|
304
314
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info(userMediaPayload);
|
|
@@ -314,7 +324,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
314
324
|
};
|
|
315
325
|
UserMediaHandler.prototype.onStreamError = function (error, isAudioRequired, isVideoRequired) {
|
|
316
326
|
var _a;
|
|
317
|
-
log.
|
|
327
|
+
log.log(error.message);
|
|
318
328
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnPermissionError, error);
|
|
319
329
|
if (isAudioRequired && this.muteUmutePromiseResolver) {
|
|
320
330
|
this.muteUmutePromiseResolver({ message: "Permission Declined", error: 'PermissionDenied', isSuccess: false });
|
|
@@ -345,61 +355,65 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
345
355
|
}
|
|
346
356
|
catch (err) {
|
|
347
357
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (!this.communicationHandler.getSelfParticipant()) {
|
|
353
|
-
return [2 /*return*/];
|
|
354
|
-
}
|
|
355
|
-
permissionApprovedFor = [];
|
|
356
|
-
if (isForAudio && stream.getAudioTracks().length > 0) {
|
|
357
|
-
this.onTrack(stream.getAudioTracks()[0], TrackKind.Audio, shouldAddTrackImmediately);
|
|
358
|
-
// removeAndStreamInLocalStream(stream.getAudioTracks()[0])
|
|
359
|
-
// updateLocalTrackInAllTracks(stream.getAudioTracks()[0]);
|
|
360
|
-
this.communicationHandler.getSelfParticipant().isAudioEnable = true;
|
|
361
|
-
data = { userId: (_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId, type: "audio", status: "resume" };
|
|
362
|
-
audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
363
|
-
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
364
|
-
if (this.muteUmutePromiseResolver) {
|
|
365
|
-
this.muteUmutePromiseResolver({ message: "Success", error: 'NoError', isSuccess: true });
|
|
366
|
-
this.muteUmutePromiseResolver = undefined;
|
|
367
|
-
}
|
|
368
|
-
if (this.meetingStartRequest
|
|
369
|
-
&& stream.getAudioTracks()[0].getSettings() && stream.getAudioTracks()[0].getSettings().deviceId) {
|
|
370
|
-
this.meetingStartRequest.audioInDevice = stream.getAudioTracks()[0].getSettings().deviceId;
|
|
371
|
-
}
|
|
372
|
-
else if (this.meetingStartRequest
|
|
373
|
-
&& stream.getAudioTracks()[0].getConstraints() && stream.getAudioTracks()[0].getConstraints().deviceId) {
|
|
374
|
-
this.meetingStartRequest.audioInDevice = (_b = stream.getAudioTracks()[0].getConstraints().deviceId) === null || _b === void 0 ? void 0 : _b.toString();
|
|
358
|
+
try {
|
|
359
|
+
if (!stream || (isForAudio === false && isForVideo === false)) {
|
|
360
|
+
this.isVideoAudioFetchInProgress = false;
|
|
361
|
+
return [2 /*return*/];
|
|
375
362
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (isForVideo && stream.getVideoTracks().length > 0) {
|
|
379
|
-
this.onTrack(stream.getVideoTracks()[0], TrackKind.Video, shouldAddTrackImmediately);
|
|
380
|
-
// removeAndStreamInLocalStream(stream.getVideoTracks()[0])
|
|
381
|
-
// updateLocalTrackInAllTracks(stream.getVideoTracks()[0])
|
|
382
|
-
this.communicationHandler.getSelfParticipant().isVideoEnable = true;
|
|
383
|
-
data = { userId: (_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId, type: "video", status: "resume" };
|
|
384
|
-
audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
385
|
-
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
386
|
-
if (this.videoPauseResumePromiseResolver) {
|
|
387
|
-
this.videoPauseResumePromiseResolver({ message: "Success", error: 'NoError', isSuccess: true });
|
|
388
|
-
this.videoPauseResumePromiseResolver = undefined;
|
|
363
|
+
if (!this.communicationHandler.getSelfParticipant()) {
|
|
364
|
+
return [2 /*return*/];
|
|
389
365
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
this.
|
|
366
|
+
permissionApprovedFor = [];
|
|
367
|
+
if (isForAudio && stream.getAudioTracks().length > 0) {
|
|
368
|
+
this.onTrack(stream.getAudioTracks()[0], TrackKind.Audio, shouldAddTrackImmediately);
|
|
369
|
+
// removeAndStreamInLocalStream(stream.getAudioTracks()[0])
|
|
370
|
+
// updateLocalTrackInAllTracks(stream.getAudioTracks()[0]);
|
|
371
|
+
this.communicationHandler.getSelfParticipant().isAudioEnable = true;
|
|
372
|
+
data = { userId: (_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId, type: "audio", status: "resume" };
|
|
373
|
+
audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
374
|
+
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
375
|
+
if (this.muteUmutePromiseResolver) {
|
|
376
|
+
this.muteUmutePromiseResolver({ message: "Success", error: 'NoError', isSuccess: true });
|
|
377
|
+
this.muteUmutePromiseResolver = undefined;
|
|
378
|
+
}
|
|
379
|
+
if (this.meetingStartRequest
|
|
380
|
+
&& stream.getAudioTracks()[0].getSettings() && stream.getAudioTracks()[0].getSettings().deviceId) {
|
|
381
|
+
this.meetingStartRequest.audioInDevice = stream.getAudioTracks()[0].getSettings().deviceId;
|
|
382
|
+
}
|
|
383
|
+
else if (this.meetingStartRequest
|
|
384
|
+
&& stream.getAudioTracks()[0].getConstraints() && stream.getAudioTracks()[0].getConstraints().deviceId) {
|
|
385
|
+
this.meetingStartRequest.audioInDevice = (_b = stream.getAudioTracks()[0].getConstraints().deviceId) === null || _b === void 0 ? void 0 : _b.toString();
|
|
386
|
+
}
|
|
387
|
+
permissionApprovedFor.push(TrackKind.Audio);
|
|
393
388
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
389
|
+
if (isForVideo && stream.getVideoTracks().length > 0) {
|
|
390
|
+
this.onTrack(stream.getVideoTracks()[0], TrackKind.Video, shouldAddTrackImmediately);
|
|
391
|
+
// removeAndStreamInLocalStream(stream.getVideoTracks()[0])
|
|
392
|
+
// updateLocalTrackInAllTracks(stream.getVideoTracks()[0])
|
|
393
|
+
this.communicationHandler.getSelfParticipant().isVideoEnable = true;
|
|
394
|
+
data = { userId: (_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId, type: "video", status: "resume" };
|
|
395
|
+
audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
396
|
+
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
397
|
+
if (this.videoPauseResumePromiseResolver) {
|
|
398
|
+
this.videoPauseResumePromiseResolver({ message: "Success", error: 'NoError', isSuccess: true });
|
|
399
|
+
this.videoPauseResumePromiseResolver = undefined;
|
|
400
|
+
}
|
|
401
|
+
if (this.meetingStartRequest
|
|
402
|
+
&& stream.getVideoTracks()[0].getSettings() && stream.getVideoTracks()[0].getSettings().deviceId) {
|
|
403
|
+
this.meetingStartRequest.cameraDevice = stream.getVideoTracks()[0].getSettings().deviceId;
|
|
404
|
+
}
|
|
405
|
+
else if (this.meetingStartRequest
|
|
406
|
+
&& stream.getVideoTracks()[0].getConstraints() && stream.getVideoTracks()[0].getConstraints().deviceId) {
|
|
407
|
+
this.meetingStartRequest.cameraDevice = (_d = stream.getVideoTracks()[0].getConstraints().deviceId) === null || _d === void 0 ? void 0 : _d.toString();
|
|
408
|
+
}
|
|
409
|
+
permissionApprovedFor.push(TrackKind.Video);
|
|
397
410
|
}
|
|
398
|
-
|
|
411
|
+
this.isVideoAudioFetchInProgress = false;
|
|
412
|
+
(_e = this.communicationHandler) === null || _e === void 0 ? void 0 : _e.emitMessageToSource(VaniEvent.OnPermissionApproved, permissionApprovedFor);
|
|
413
|
+
this.registerForDeviceChange();
|
|
414
|
+
}
|
|
415
|
+
catch (er) {
|
|
399
416
|
}
|
|
400
|
-
this.isVideoAudioFetchInProgress = false;
|
|
401
|
-
(_e = this.communicationHandler) === null || _e === void 0 ? void 0 : _e.emitMessageToSource(VaniEvent.OnPermissionApproved, permissionApprovedFor);
|
|
402
|
-
this.registerForDeviceChange();
|
|
403
417
|
return [2 /*return*/];
|
|
404
418
|
});
|
|
405
419
|
});
|
|
@@ -441,16 +455,19 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
441
455
|
};
|
|
442
456
|
UserMediaHandler.prototype.onTrack = function (trackStream, trackKind, shouldAddTrackImmediately) {
|
|
443
457
|
var _a, _b, _c;
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
458
|
+
try {
|
|
459
|
+
var selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
460
|
+
if (selfParticpant) {
|
|
461
|
+
var track = new Track(selfParticpant, true, trackKind, trackStream);
|
|
462
|
+
if (!shouldAddTrackImmediately) {
|
|
463
|
+
(_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.emitMessageToSource(VaniEvent.OnTrack, track);
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.addUpdateLocalTrack(track);
|
|
467
|
+
}
|
|
452
468
|
}
|
|
453
469
|
}
|
|
470
|
+
catch (err) { }
|
|
454
471
|
};
|
|
455
472
|
UserMediaHandler.prototype.getDevice = function (type) {
|
|
456
473
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -620,11 +637,12 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
620
637
|
var _this = this;
|
|
621
638
|
return __generator(this, function (_a) {
|
|
622
639
|
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
623
|
-
var participant, videoInputDevices, data, videoUnblock, participant;
|
|
640
|
+
var participant, videoInputDevices, data, videoUnblock, participant, err_1;
|
|
624
641
|
var _a, _b, _c;
|
|
625
642
|
return __generator(this, function (_d) {
|
|
626
643
|
switch (_d.label) {
|
|
627
644
|
case 0:
|
|
645
|
+
_d.trys.push([0, 4, , 5]);
|
|
628
646
|
if (!this.meetingStartRequest) {
|
|
629
647
|
resolve({ message: "Start Meeting Object not found", error: 'InvalidMeetingRequest', isSuccess: false });
|
|
630
648
|
return [2 /*return*/];
|
|
@@ -665,7 +683,11 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
665
683
|
resolve({ message: "Permission Not Allowed", error: 'PermissionDenied', isSuccess: false });
|
|
666
684
|
}
|
|
667
685
|
_d.label = 3;
|
|
668
|
-
case 3: return [
|
|
686
|
+
case 3: return [3 /*break*/, 5];
|
|
687
|
+
case 4:
|
|
688
|
+
err_1 = _d.sent();
|
|
689
|
+
return [3 /*break*/, 5];
|
|
690
|
+
case 5: return [2 /*return*/];
|
|
669
691
|
}
|
|
670
692
|
});
|
|
671
693
|
}); })];
|
|
@@ -677,11 +699,12 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
677
699
|
var _this = this;
|
|
678
700
|
return __generator(this, function (_a) {
|
|
679
701
|
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
680
|
-
var participant, audioInputDevices, data, audioUnblock, participant;
|
|
702
|
+
var participant, audioInputDevices, data, audioUnblock, participant, err_2;
|
|
681
703
|
var _a, _b, _c;
|
|
682
704
|
return __generator(this, function (_d) {
|
|
683
705
|
switch (_d.label) {
|
|
684
706
|
case 0:
|
|
707
|
+
_d.trys.push([0, 4, , 5]);
|
|
685
708
|
if (!this.meetingStartRequest) {
|
|
686
709
|
resolve({ message: "Start Meeting Object not found", error: 'InvalidMeetingRequest', isSuccess: false });
|
|
687
710
|
return [2 /*return*/];
|
|
@@ -722,7 +745,11 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
722
745
|
resolve({ message: "Permission Not Allowed", error: 'PermissionDenied', isSuccess: false });
|
|
723
746
|
}
|
|
724
747
|
_d.label = 3;
|
|
725
|
-
case 3: return [
|
|
748
|
+
case 3: return [3 /*break*/, 5];
|
|
749
|
+
case 4:
|
|
750
|
+
err_2 = _d.sent();
|
|
751
|
+
return [3 /*break*/, 5];
|
|
752
|
+
case 5: return [2 /*return*/];
|
|
726
753
|
}
|
|
727
754
|
});
|
|
728
755
|
}); })];
|
|
@@ -772,14 +799,19 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
772
799
|
}
|
|
773
800
|
};
|
|
774
801
|
UserMediaHandler.prototype.cleanup = function () {
|
|
775
|
-
this
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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
|
+
});
|
|
781
814
|
});
|
|
782
|
-
_super.prototype.cleanup.call(this);
|
|
783
815
|
};
|
|
784
816
|
return UserMediaHandler;
|
|
785
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,53 +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
|
-
this
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
}
|
|
896
|
-
if (this.producers) {
|
|
897
|
-
this.producers.forEach(function (producer) {
|
|
898
|
-
var _a;
|
|
899
|
-
try {
|
|
900
|
-
if (shouldStopTracks) {
|
|
901
|
-
(_a = producer.track) === null || _a === void 0 ? void 0 : _a.stop();
|
|
888
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
889
|
+
return __generator(this, function (_a) {
|
|
890
|
+
if (this.sendTransport) {
|
|
891
|
+
try {
|
|
892
|
+
this.sendTransport.close();
|
|
893
|
+
}
|
|
894
|
+
catch (err) {
|
|
902
895
|
}
|
|
896
|
+
this.sendTransport = undefined;
|
|
903
897
|
}
|
|
904
|
-
|
|
898
|
+
if (this.consumerTransport) {
|
|
899
|
+
try {
|
|
900
|
+
this.consumerTransport.close();
|
|
901
|
+
}
|
|
902
|
+
catch (err) {
|
|
903
|
+
}
|
|
904
|
+
this.consumerTransport = undefined;
|
|
905
905
|
}
|
|
906
|
-
if (
|
|
907
|
-
|
|
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
|
+
});
|
|
908
928
|
}
|
|
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*/];
|
|
909
962
|
});
|
|
910
|
-
}
|
|
911
|
-
this.dataProducers.forEach(function (producer) {
|
|
912
|
-
if (producer.closed === false) {
|
|
913
|
-
if (shouldStopTracks) {
|
|
914
|
-
producer.close();
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
this.dataConsumer.forEach(function (consumer) {
|
|
919
|
-
if (consumer.closed === false) {
|
|
920
|
-
consumer.close();
|
|
921
|
-
}
|
|
922
|
-
});
|
|
923
|
-
this.consumers.forEach(function (consumer) {
|
|
924
|
-
var _a;
|
|
925
|
-
try {
|
|
926
|
-
(_a = consumer.track) === null || _a === void 0 ? void 0 : _a.stop();
|
|
927
|
-
}
|
|
928
|
-
catch (err) {
|
|
929
|
-
}
|
|
930
|
-
if (consumer.closed === false) {
|
|
931
|
-
consumer.close();
|
|
932
|
-
}
|
|
933
963
|
});
|
|
934
|
-
_super.prototype.cleanup.call(this);
|
|
935
964
|
};
|
|
936
965
|
return SFUHandler;
|
|
937
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 () {
|
|
@@ -192,7 +198,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
192
198
|
var _this = this;
|
|
193
199
|
return __generator(this, function (_a) {
|
|
194
200
|
if (!this.meetingStartRequest) {
|
|
195
|
-
log.
|
|
201
|
+
log.log("meetingStartRequest not found on startSocketConnection");
|
|
196
202
|
return [2 /*return*/];
|
|
197
203
|
}
|
|
198
204
|
if (this.meetingStartRequest.dynamicWebSocketFetchBaseUrl) {
|
|
@@ -218,7 +224,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
218
224
|
})
|
|
219
225
|
.catch(function (error) {
|
|
220
226
|
_this.connect(false);
|
|
221
|
-
log.warn(error)
|
|
227
|
+
// log.warn(error)
|
|
222
228
|
_this.connect(false);
|
|
223
229
|
});
|
|
224
230
|
}
|
|
@@ -250,7 +256,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
250
256
|
if (url) {
|
|
251
257
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Connecting to ", url);
|
|
252
258
|
this.isWebSocketConnectionInProgress = true;
|
|
253
|
-
if ((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.isMobileApp) {
|
|
259
|
+
if (this.meetingStartRequest && ((_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.isMobileApp)) {
|
|
254
260
|
this.wss = new WebSocket(url + this.connection);
|
|
255
261
|
}
|
|
256
262
|
else {
|
|
@@ -271,16 +277,21 @@ 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 && _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) {
|
|
281
292
|
_this.isWebSocketConnectionInProgress = false;
|
|
282
293
|
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && ("WebSocket is closed now.");
|
|
283
|
-
log.warn(event)
|
|
294
|
+
// log.warn(event)
|
|
284
295
|
_this.onWebSocketClosed(event);
|
|
285
296
|
};
|
|
286
297
|
}
|
|
@@ -314,7 +325,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
314
325
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnReconecting, {});
|
|
315
326
|
this.wss.close(3005);
|
|
316
327
|
this.wss = undefined;
|
|
317
|
-
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("this.wss
|
|
328
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("this.wss reconnectOnInternetFailur ");
|
|
318
329
|
}
|
|
319
330
|
this.connection = ConnectionType.reconnect;
|
|
320
331
|
this.connect(true);
|
|
@@ -335,6 +346,9 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
335
346
|
var _a;
|
|
336
347
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("onWebSocketClosed", event.code);
|
|
337
348
|
if (event.code === 3005 || event.wasClean === false || (event.message && event.message.toLowerCase().includes("software") && event.message.toLowerCase().includes("abort")) || (event.message && event.message.toLowerCase().includes("no address"))) {
|
|
349
|
+
if (this.isWebSocketConnectionInProgress) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
338
352
|
this.socketCheckTimeout = window.setTimeout(function () {
|
|
339
353
|
var _a;
|
|
340
354
|
_this.tryToReconectSocket();
|
|
@@ -347,6 +361,9 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
347
361
|
};
|
|
348
362
|
WebsocketHandler.prototype.tryToReconectSocket = function () {
|
|
349
363
|
var _a, _b;
|
|
364
|
+
if (this.isWebSocketConnectionInProgress) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
350
367
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("tryToReconectSocket");
|
|
351
368
|
if (this.isWebScoketConnected() === false && this.isEnded === false) {
|
|
352
369
|
this.wss = undefined;
|