vani-meeting-client-native 0.0.7 → 0.0.9
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 +7 -6
- package/lib/MeetingHandler.js +45 -20
- package/lib/inter-communication-handler/CommunicationHandler.d.ts +4 -2
- package/lib/inter-communication-handler/CommunicationHandler.js +48 -11
- package/lib/model/Event.d.ts +8 -1
- package/lib/model/Event.js +3 -0
- package/lib/model/MeetingStartRequest.d.ts +1 -0
- package/lib/model/MeetingStartRequest.js +1 -0
- package/lib/model/MessagePayload.d.ts +1 -1
- package/lib/user-media-handler/UserMediaHandler.d.ts +1 -1
- package/lib/user-media-handler/UserMediaHandler.js +107 -75
- package/lib/utility/DynamicLibHelper.d.ts +1 -1
- package/lib/utility/DynamicLibHelper.native.d.ts +1 -1
- package/lib/utility/DynamicLibHelper.node.d.ts +1 -1
- 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 +2 -2
- package/lib/video-call-handler/SFUHandler.js +73 -42
- package/lib/websocket-handler/WebsocketHandler.d.ts +1 -1
- package/lib/websocket-handler/WebsocketHandler.js +40 -29
- 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<
|
|
19
|
-
recreateVideoCallHandler: () => Promise<BaseVideoCallHandler
|
|
18
|
+
init(): Promise<boolean>;
|
|
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>;
|
|
@@ -36,7 +36,7 @@ export declare class MeetingHandler {
|
|
|
36
36
|
updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
|
|
37
37
|
resumeProducerOrConsumerForTrack(track: Track): Promise<void>;
|
|
38
38
|
pauseProducerOrConsumerForTrack(track: Track): Promise<void>;
|
|
39
|
-
getConsumerForTrack(track: Track): void
|
|
39
|
+
getConsumerForTrack(track: Track): void;
|
|
40
40
|
participantByUserId(userId: string): Participant | undefined;
|
|
41
41
|
updateParticipantData(participant: Participant): Participant | undefined;
|
|
42
42
|
getUpdatedParticipantsListFromServer(): void;
|
|
@@ -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 () {
|
|
@@ -10,6 +10,7 @@ export declare class CommunicationHandler {
|
|
|
10
10
|
private allParticipants;
|
|
11
11
|
private selfTracks;
|
|
12
12
|
private allTracks;
|
|
13
|
+
private allSelfTracksForRestartSFU;
|
|
13
14
|
private meetingStartRequest?;
|
|
14
15
|
private websocketCallHandler?;
|
|
15
16
|
private videoCallHandler?;
|
|
@@ -43,7 +44,7 @@ export declare class CommunicationHandler {
|
|
|
43
44
|
removeTrack(track: Track, shouldInfromVideoController?: boolean): void;
|
|
44
45
|
resumeProducerOrConsumerForTrack(track: Track): void;
|
|
45
46
|
pauseProducerOrConsumerForTrack(track: Track): void;
|
|
46
|
-
getConsumerForTrack(track: Track): void
|
|
47
|
+
getConsumerForTrack(track: Track): void;
|
|
47
48
|
addUpdateRemoteTrack(track: Track, participant: Participant, shouldInfromIfNotExist?: boolean): Track;
|
|
48
49
|
addUpdateLocalTrack(track: Track): void;
|
|
49
50
|
onOldMessages(data: any): void;
|
|
@@ -62,6 +63,7 @@ export declare class CommunicationHandler {
|
|
|
62
63
|
checkIfInternetReachable: (count: number) => void;
|
|
63
64
|
private onApiResponded;
|
|
64
65
|
restartSFU: () => Promise<void>;
|
|
66
|
+
onSFUInitDone: () => Promise<void>;
|
|
65
67
|
private reloadSFUCleanUpDone;
|
|
66
|
-
cleanup(): void
|
|
68
|
+
cleanup(): Promise<void>;
|
|
67
69
|
}
|
|
@@ -49,6 +49,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
49
49
|
this.allParticipants = [];
|
|
50
50
|
this.selfTracks = [];
|
|
51
51
|
this.allTracks = [];
|
|
52
|
+
this.allSelfTracksForRestartSFU = undefined;
|
|
52
53
|
this.isReachable = true;
|
|
53
54
|
this.restartTransport = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
54
55
|
var _a;
|
|
@@ -76,9 +77,13 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
76
77
|
(_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
79
|
-
if (count ===
|
|
80
|
+
if (count === 10) {
|
|
80
81
|
_this.emitMessageToSource(VaniEvent.OnNotReachable, {});
|
|
82
|
+
if (_this.meetingStartRequest.isMobileApp) {
|
|
83
|
+
_this.emitMessageToSource(VaniEvent.OnSocketError, {});
|
|
84
|
+
}
|
|
81
85
|
}
|
|
86
|
+
_this.emitMessageToSource(VaniEvent.CheckingInternetConnection, {});
|
|
82
87
|
_this.isReachable = false;
|
|
83
88
|
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("checkIfInternetReachable");
|
|
84
89
|
fetch(_this.meetingStartRequest.urlToCheckInternetPresent, {
|
|
@@ -108,12 +113,29 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
108
113
|
var messageJson;
|
|
109
114
|
var _a;
|
|
110
115
|
return __generator(this, function (_b) {
|
|
116
|
+
if (this.allSelfTracksForRestartSFU) {
|
|
117
|
+
return [2 /*return*/];
|
|
118
|
+
}
|
|
111
119
|
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.cleanup(false);
|
|
112
120
|
messageJson = { to: "self", type: SFUMessageType.ReloadSFU, message: SFUMessageType.ReloadSFU };
|
|
113
121
|
this.sendWebSocketMessage(SFUMessageType.SFUMessage, messageJson);
|
|
114
122
|
return [2 /*return*/];
|
|
115
123
|
});
|
|
116
124
|
}); };
|
|
125
|
+
this.onSFUInitDone = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug &&
|
|
128
|
+
console.log("onSFUInitDone", this.allSelfTracksForRestartSFU);
|
|
129
|
+
this.emitMessageToSource(VaniEvent.OnSFUConnected, undefined);
|
|
130
|
+
if (this.allSelfTracksForRestartSFU) {
|
|
131
|
+
this.emitMessageToSource(VaniEvent.ResendTracks, this.allSelfTracksForRestartSFU);
|
|
132
|
+
if (this.allSelfTracksForRestartSFU && this.allSelfTracksForRestartSFU.length === 0) {
|
|
133
|
+
this.allSelfTracksForRestartSFU = undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return [2 /*return*/];
|
|
137
|
+
});
|
|
138
|
+
}); };
|
|
117
139
|
this.reloadSFUCleanUpDone = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
118
140
|
var videoCallHandler;
|
|
119
141
|
var _a;
|
|
@@ -121,7 +143,10 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
121
143
|
switch (_b.label) {
|
|
122
144
|
case 0:
|
|
123
145
|
this.videoCallHandler = undefined;
|
|
124
|
-
this.
|
|
146
|
+
this.allSelfTracksForRestartSFU = this.allTracks.filter(function (eachTrack) { return eachTrack.isLocalTrack === true; });
|
|
147
|
+
this.allTracks = [];
|
|
148
|
+
this.selfTracks = [];
|
|
149
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("reloadSFUCleanUpDone", this.allSelfTracksForRestartSFU);
|
|
125
150
|
return [4 /*yield*/, ((_a = this.meetingHandler) === null || _a === void 0 ? void 0 : _a.recreateVideoCallHandler())];
|
|
126
151
|
case 1:
|
|
127
152
|
videoCallHandler = _b.sent();
|
|
@@ -394,6 +419,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
394
419
|
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.sendTrack(track);
|
|
395
420
|
}
|
|
396
421
|
this.emitMessageToSource(VaniEvent.OnTrack, track);
|
|
422
|
+
this.allSelfTracksForRestartSFU = undefined;
|
|
397
423
|
};
|
|
398
424
|
CommunicationHandler.prototype.onOldMessages = function (data) {
|
|
399
425
|
var _this = this;
|
|
@@ -538,19 +564,30 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
538
564
|
// if (count < 2 && this.websocketCallHandler?.isWebScoketConnected()) {
|
|
539
565
|
// this.videoCallHandler?.reconnectedWithoutPing()
|
|
540
566
|
// }
|
|
541
|
-
(
|
|
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
|
+
}
|
|
542
573
|
}
|
|
543
574
|
};
|
|
544
575
|
CommunicationHandler.prototype.cleanup = function () {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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
|
+
});
|
|
548
590
|
});
|
|
549
|
-
this.eventEmitter.removeAllListeners();
|
|
550
|
-
this.videoCallHandler = undefined;
|
|
551
|
-
this.meetingStartRequest = undefined;
|
|
552
|
-
this.websocketCallHandler = undefined;
|
|
553
|
-
this.meetingHandler = undefined;
|
|
554
591
|
};
|
|
555
592
|
return CommunicationHandler;
|
|
556
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",
|
|
@@ -36,13 +37,16 @@ export declare enum VaniEvent {
|
|
|
36
37
|
OnNewPingFromServer = "OnNewPingFromServer",
|
|
37
38
|
OnConsumerScoreChange = "OnConsumerScoreChange",
|
|
38
39
|
OnProducerScoreChange = "OnProducerScoreChange",
|
|
39
|
-
OnConsumerLayerChange = "OnConsumerLayerChange"
|
|
40
|
+
OnConsumerLayerChange = "OnConsumerLayerChange",
|
|
41
|
+
OnSFUConnected = "OnSFUReconnected",
|
|
42
|
+
ResendTracks = "ResendTracks"
|
|
40
43
|
}
|
|
41
44
|
interface VaniConnectionEvents {
|
|
42
45
|
[VaniEvent.OnInitDone]: () => any;
|
|
43
46
|
[VaniEvent.OnSocketError]: (error: any) => any;
|
|
44
47
|
[VaniEvent.OnSocketConnected]: () => any;
|
|
45
48
|
[VaniEvent.OnSocketReconnectTimeOut]: () => any;
|
|
49
|
+
[VaniEvent.CheckingInternetConnection]: () => any;
|
|
46
50
|
[VaniEvent.OnConnected]: () => any;
|
|
47
51
|
[VaniEvent.OnConnectionBack]: () => any;
|
|
48
52
|
[VaniEvent.OnPermissionError]: (error: DOMException) => any;
|
|
@@ -88,12 +92,15 @@ interface VaniConnectionEvents {
|
|
|
88
92
|
[VaniEvent.OnVideoBlocked]: (participant: Participant) => any;
|
|
89
93
|
[VaniEvent.OnAudioBlocked]: (participant: Participant) => any;
|
|
90
94
|
[VaniEvent.OnSocketDisconnected]: () => any;
|
|
95
|
+
[VaniEvent.OnSFUConnected]: () => any;
|
|
96
|
+
[VaniEvent.ResendTracks]: (tracks: Track[]) => any;
|
|
91
97
|
[VaniEvent.OnAskedToCloseTheRoom]: () => any;
|
|
92
98
|
}
|
|
93
99
|
export declare interface VaniEventListener {
|
|
94
100
|
on<U extends keyof VaniConnectionEvents>(event: U, listener: VaniConnectionEvents[U]): this;
|
|
95
101
|
off<U extends keyof VaniConnectionEvents>(event: U, listener: VaniConnectionEvents[U]): this;
|
|
96
102
|
emit<U extends keyof VaniConnectionEvents>(event: U, ...args: Parameters<VaniConnectionEvents[U]>): boolean;
|
|
103
|
+
removeAllListeners(): this;
|
|
97
104
|
}
|
|
98
105
|
export interface Device {
|
|
99
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";
|
|
@@ -35,4 +36,6 @@ export var VaniEvent;
|
|
|
35
36
|
VaniEvent["OnConsumerScoreChange"] = "OnConsumerScoreChange";
|
|
36
37
|
VaniEvent["OnProducerScoreChange"] = "OnProducerScoreChange";
|
|
37
38
|
VaniEvent["OnConsumerLayerChange"] = "OnConsumerLayerChange";
|
|
39
|
+
VaniEvent["OnSFUConnected"] = "OnSFUReconnected";
|
|
40
|
+
VaniEvent["ResendTracks"] = "ResendTracks";
|
|
38
41
|
})(VaniEvent || (VaniEvent = {}));
|
|
@@ -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));
|
|
@@ -2,7 +2,7 @@ import { MeetingStartRequest, MeetingType } from '..';
|
|
|
2
2
|
import { CommunicationHandler } from '../inter-communication-handler/CommunicationHandler';
|
|
3
3
|
export declare class DynamicLibHelper {
|
|
4
4
|
getReactNativeWebrtcPlugin(meetingStartRequest: MeetingStartRequest): Promise<any>;
|
|
5
|
-
getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler
|
|
5
|
+
getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler>;
|
|
6
6
|
getMediaDevicesVariable(meetingStartRequest: MeetingStartRequest): any;
|
|
7
7
|
getMediaStreamVariable(meetingStartRequest: MeetingStartRequest): any;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import { MeetingStartRequest, MeetingType } from '..';
|
|
|
2
2
|
import { CommunicationHandler } from '../inter-communication-handler/CommunicationHandler';
|
|
3
3
|
export declare class DynamicLibHelper {
|
|
4
4
|
getReactNativeWebrtcPlugin(meetingStartRequest: MeetingStartRequest): Promise<any>;
|
|
5
|
-
getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler
|
|
5
|
+
getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler>;
|
|
6
6
|
getMediaDevicesVariable(meetingStartRequest: MeetingStartRequest): any;
|
|
7
7
|
getMediaStreamVariable(meetingStartRequest: MeetingStartRequest): any;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import { MeetingStartRequest, MeetingType } from '..';
|
|
|
2
2
|
import { CommunicationHandler } from '../inter-communication-handler/CommunicationHandler';
|
|
3
3
|
export declare class DynamicLibHelper {
|
|
4
4
|
getReactNativeWebrtcPlugin(meetingStartRequest: MeetingStartRequest): Promise<any>;
|
|
5
|
-
getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler
|
|
5
|
+
getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler>;
|
|
6
6
|
getMediaDevicesVariable(meetingStartRequest: MeetingStartRequest): any;
|
|
7
7
|
getMediaStreamVariable(meetingStartRequest: MeetingStartRequest): any;
|
|
8
8
|
}
|
|
@@ -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
|
};
|
|
@@ -22,7 +22,7 @@ export declare class SFUHandler extends BaseVideoCallHandler {
|
|
|
22
22
|
private onRestartIceCandidateResponse;
|
|
23
23
|
stopTrack(track: Track): void;
|
|
24
24
|
pauseTrack(track: Track): void;
|
|
25
|
-
getConsumerForTrack(track: Track): Consumer<import("mediasoup-client/lib/types").AppData
|
|
25
|
+
getConsumerForTrack(track: Track): Consumer<import("mediasoup-client/lib/types").AppData>;
|
|
26
26
|
resumeProducerOrConsumerForTrack(track: Track): Promise<void>;
|
|
27
27
|
pauseProducerOrConsumerForTrack(track: Track): Promise<void>;
|
|
28
28
|
resumeTrack(track: Track): void;
|
|
@@ -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
|
}
|
|
@@ -666,7 +666,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
666
666
|
};
|
|
667
667
|
SFUHandler.prototype.produceTracks = function () {
|
|
668
668
|
var _this = this;
|
|
669
|
-
var _a;
|
|
669
|
+
var _a, _b;
|
|
670
670
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("produceTracks");
|
|
671
671
|
if (!this.sendTransport || !this.consumerTransport || this.isProduceTrackIntialWorkDone) {
|
|
672
672
|
return;
|
|
@@ -682,6 +682,8 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
682
682
|
else {
|
|
683
683
|
this.sendMessageReadyToConsume();
|
|
684
684
|
}
|
|
685
|
+
//inform init is done(mainly used when restart SFU)
|
|
686
|
+
(_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.onSFUInitDone();
|
|
685
687
|
// if (this.meetingStartRequest?.isDataChannelRequired) {
|
|
686
688
|
// this.createDataChannel()
|
|
687
689
|
// }
|
|
@@ -883,53 +885,82 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
883
885
|
};
|
|
884
886
|
SFUHandler.prototype.cleanup = function (shouldStopTracks) {
|
|
885
887
|
if (shouldStopTracks === void 0) { shouldStopTracks = true; }
|
|
886
|
-
|
|
887
|
-
this
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
this.consumerTransport.close();
|
|
892
|
-
this.consumerTransport = undefined;
|
|
893
|
-
}
|
|
894
|
-
if (this.producers) {
|
|
895
|
-
this.producers.forEach(function (producer) {
|
|
896
|
-
var _a;
|
|
897
|
-
try {
|
|
898
|
-
if (shouldStopTracks) {
|
|
899
|
-
(_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();
|
|
900
893
|
}
|
|
894
|
+
catch (err) {
|
|
895
|
+
}
|
|
896
|
+
this.sendTransport = undefined;
|
|
901
897
|
}
|
|
902
|
-
|
|
898
|
+
if (this.consumerTransport) {
|
|
899
|
+
try {
|
|
900
|
+
this.consumerTransport.close();
|
|
901
|
+
}
|
|
902
|
+
catch (err) {
|
|
903
|
+
}
|
|
904
|
+
this.consumerTransport = undefined;
|
|
903
905
|
}
|
|
904
|
-
if (
|
|
905
|
-
|
|
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
|
+
});
|
|
906
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*/];
|
|
907
962
|
});
|
|
908
|
-
}
|
|
909
|
-
this.dataProducers.forEach(function (producer) {
|
|
910
|
-
if (producer.closed === false) {
|
|
911
|
-
if (shouldStopTracks) {
|
|
912
|
-
producer.close();
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
this.dataConsumer.forEach(function (consumer) {
|
|
917
|
-
if (consumer.closed === false) {
|
|
918
|
-
consumer.close();
|
|
919
|
-
}
|
|
920
|
-
});
|
|
921
|
-
this.consumers.forEach(function (consumer) {
|
|
922
|
-
var _a;
|
|
923
|
-
try {
|
|
924
|
-
(_a = consumer.track) === null || _a === void 0 ? void 0 : _a.stop();
|
|
925
|
-
}
|
|
926
|
-
catch (err) {
|
|
927
|
-
}
|
|
928
|
-
if (consumer.closed === false) {
|
|
929
|
-
consumer.close();
|
|
930
|
-
}
|
|
931
963
|
});
|
|
932
|
-
_super.prototype.cleanup.call(this);
|
|
933
964
|
};
|
|
934
965
|
return SFUHandler;
|
|
935
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
|
}
|
|
@@ -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.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
|
}
|