vani-meeting-client 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/inter-communication-handler/CommunicationHandler.d.ts +1 -0
- package/lib/inter-communication-handler/CommunicationHandler.js +22 -1
- package/lib/model/Participant.js +6 -1
- package/lib/model/PeerConnection.js +2 -0
- package/lib/user-media-handler/UserMediaHandler.js +9 -1
- package/lib/utility/DynamicLibHelper.d.ts +1 -1
- package/lib/utility/DynamicLibHelper.js +1 -1
- package/lib/utility/DynamicLibHelper.native.d.ts +1 -1
- package/lib/utility/DynamicLibHelper.native.js +2 -4
- package/lib/utility/DynamicLibHelper.node.d.ts +1 -1
- package/lib/utility/DynamicLibHelper.node.js +1 -1
- package/lib/video-call-handler/BaseVideoCallHandler.d.ts +1 -0
- package/lib/video-call-handler/BaseVideoCallHandler.js +7 -0
- package/lib/video-call-handler/SFUHandler.js +7 -2
- package/lib/video-call-handler/WebrtcHandler.d.ts +11 -0
- package/lib/video-call-handler/WebrtcHandler.js +176 -33
- package/lib/websocket-handler/WebsocketHandler.d.ts +2 -0
- package/lib/websocket-handler/WebsocketHandler.js +19 -14
- package/package.json +1 -1
|
@@ -32,6 +32,7 @@ export declare class CommunicationHandler {
|
|
|
32
32
|
onServerParticipants(data: any): void;
|
|
33
33
|
getAllParticipants(): Participant[];
|
|
34
34
|
participantByUserId(userId: string): Participant | undefined;
|
|
35
|
+
onStartParticipantMeetingCalled: (participantData: any) => Promise<void>;
|
|
35
36
|
addParticipantIfNotExist(participant: Participant, shouldInfrom?: boolean): Participant | undefined;
|
|
36
37
|
removeParticipant(participant: Participant, shouldInfrom?: boolean): void;
|
|
37
38
|
onUserLeft(data: any): void;
|
|
@@ -58,6 +58,19 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
58
58
|
return [2 /*return*/];
|
|
59
59
|
});
|
|
60
60
|
}); };
|
|
61
|
+
this.onStartParticipantMeetingCalled = function (participantData) { return __awaiter(_this, void 0, void 0, function () {
|
|
62
|
+
var participant;
|
|
63
|
+
var _a;
|
|
64
|
+
return __generator(this, function (_b) {
|
|
65
|
+
if (participantData && participantData.userId && participantData.userId !== this.getSelfParticipant().userId) {
|
|
66
|
+
participant = this.addParticipantIfNotExist(participantData, true);
|
|
67
|
+
participant.isStartMeetingCalled = true;
|
|
68
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onStartParticipantMeetingCalled", participant);
|
|
69
|
+
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.onParticipantStartMeetingCalled(participant);
|
|
70
|
+
}
|
|
71
|
+
return [2 /*return*/];
|
|
72
|
+
});
|
|
73
|
+
}); };
|
|
61
74
|
this.requestToCloseTheRoom = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
62
75
|
var _a;
|
|
63
76
|
return __generator(this, function (_b) {
|
|
@@ -353,6 +366,9 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
353
366
|
else if (track.trackKind === TrackKind.Video) {
|
|
354
367
|
track.participant.isVideoEnable = false;
|
|
355
368
|
}
|
|
369
|
+
if (this.getSelfParticipant().isStartMeetingCalled && !this.isStartAndSetupWithServerCalled) {
|
|
370
|
+
this.isStartAndSetupWithServerCalled = this.getSelfParticipant().isStartMeetingCalled;
|
|
371
|
+
}
|
|
356
372
|
if (shouldInfromVideoController && this.isStartAndSetupWithServerCalled && track.isLocalTrack) {
|
|
357
373
|
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.stopTrack(track);
|
|
358
374
|
}
|
|
@@ -413,6 +429,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
413
429
|
var _this = this;
|
|
414
430
|
var _a;
|
|
415
431
|
var oldTrack = this.getLocalTrackById(track.trackId);
|
|
432
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("addUpdateLocalTrack", oldTrack);
|
|
416
433
|
if (oldTrack) {
|
|
417
434
|
oldTrack.updateTrackWithNewData(track);
|
|
418
435
|
track = oldTrack;
|
|
@@ -433,7 +450,11 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
433
450
|
if (!this.videoCallHandler) {
|
|
434
451
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("No Video Handler While Sending Track");
|
|
435
452
|
}
|
|
436
|
-
if (this.isStartAndSetupWithServerCalled) {
|
|
453
|
+
if (this.getSelfParticipant().isStartMeetingCalled && !this.isStartAndSetupWithServerCalled) {
|
|
454
|
+
this.isStartAndSetupWithServerCalled = this.getSelfParticipant().isStartMeetingCalled;
|
|
455
|
+
}
|
|
456
|
+
if (this.isStartAndSetupWithServerCalled || this.getSelfParticipant().isStartMeetingCalled) {
|
|
457
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Call Send Track", track);
|
|
437
458
|
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.sendTrack(track);
|
|
438
459
|
}
|
|
439
460
|
this.emitMessageToSource(VaniEvent.OnTrack, track);
|
package/lib/model/Participant.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DynamicLibHelper } from "../utility/DynamicLibHelper";
|
|
1
2
|
import { PeerConnection } from "./PeerConnection";
|
|
2
3
|
var Participant = /** @class */ (function () {
|
|
3
4
|
function Participant(_userId, _roomId, _userData, _isAdmin) {
|
|
@@ -23,7 +24,11 @@ var Participant = /** @class */ (function () {
|
|
|
23
24
|
};
|
|
24
25
|
this.getPeerConnectionsViaUserId = function (userId) {
|
|
25
26
|
if (!_this.getPeerConnections().has(userId)) {
|
|
26
|
-
|
|
27
|
+
var peerConnection = new PeerConnection();
|
|
28
|
+
if (!peerConnection.rtcPeerConnection) {
|
|
29
|
+
peerConnection.rtcPeerConnection = new DynamicLibHelper().getRTCPeerConnection();
|
|
30
|
+
}
|
|
31
|
+
_this.getPeerConnections().set(userId, peerConnection);
|
|
27
32
|
}
|
|
28
33
|
return _this.getPeerConnections().get(userId);
|
|
29
34
|
};
|
|
@@ -184,7 +184,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
184
184
|
})
|
|
185
185
|
.catch(function (error) {
|
|
186
186
|
var _a;
|
|
187
|
-
log
|
|
187
|
+
console.log(error);
|
|
188
188
|
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.emitMessageToSource(VaniEvent.OnPermissionError, error);
|
|
189
189
|
_this.isScreenShareFetchInProgress = false;
|
|
190
190
|
});
|
|
@@ -311,6 +311,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
311
311
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log(userMediaPayload);
|
|
312
312
|
(new DynamicLibHelper()).getMediaDevicesVariable(this.meetingStartRequest).getUserMedia(userMediaPayload)
|
|
313
313
|
.then(function (stream) {
|
|
314
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On Got Stream", stream);
|
|
314
315
|
_this.onStreamGot(stream, isAudioRequired, isVideoRequired, shouldAddTrackImmediately);
|
|
315
316
|
})
|
|
316
317
|
.catch(function (error) {
|
|
@@ -351,13 +352,16 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
351
352
|
}
|
|
352
353
|
}
|
|
353
354
|
catch (err) {
|
|
355
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On Got Stream error", err);
|
|
354
356
|
}
|
|
355
357
|
try {
|
|
356
358
|
if (!stream || (isForAudio === false && isForVideo === false)) {
|
|
357
359
|
this.isVideoAudioFetchInProgress = false;
|
|
360
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("No No Stream return");
|
|
358
361
|
return [2 /*return*/];
|
|
359
362
|
}
|
|
360
363
|
if (!this.communicationHandler.getSelfParticipant()) {
|
|
364
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("No Participant return");
|
|
361
365
|
return [2 /*return*/];
|
|
362
366
|
}
|
|
363
367
|
permissionApprovedFor = [];
|
|
@@ -410,6 +414,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
410
414
|
this.registerForDeviceChange();
|
|
411
415
|
}
|
|
412
416
|
catch (er) {
|
|
417
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On Got Stream error 306", er);
|
|
413
418
|
}
|
|
414
419
|
return [2 /*return*/];
|
|
415
420
|
});
|
|
@@ -453,13 +458,16 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
453
458
|
UserMediaHandler.prototype.onTrack = function (trackStream, trackKind, shouldAddTrackImmediately) {
|
|
454
459
|
var _a, _b, _c;
|
|
455
460
|
try {
|
|
461
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On Track Called");
|
|
456
462
|
var selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
457
463
|
if (selfParticpant) {
|
|
458
464
|
var track = new Track(selfParticpant, true, trackKind, trackStream);
|
|
459
465
|
if (!shouldAddTrackImmediately) {
|
|
466
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Emit On Track From User Media");
|
|
460
467
|
(_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.emitMessageToSource(VaniEvent.OnTrack, track);
|
|
461
468
|
}
|
|
462
469
|
else {
|
|
470
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("onTrack addUpdateLocalTrack");
|
|
463
471
|
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.addUpdateLocalTrack(track);
|
|
464
472
|
}
|
|
465
473
|
}
|
|
@@ -5,5 +5,5 @@ export declare class DynamicLibHelper {
|
|
|
5
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
|
-
getRTCPeerConnection(
|
|
8
|
+
getRTCPeerConnection(): any;
|
|
9
9
|
}
|
|
@@ -103,7 +103,7 @@ var DynamicLibHelper = /** @class */ (function () {
|
|
|
103
103
|
}
|
|
104
104
|
return MediaStream;
|
|
105
105
|
};
|
|
106
|
-
DynamicLibHelper.prototype.getRTCPeerConnection = function (
|
|
106
|
+
DynamicLibHelper.prototype.getRTCPeerConnection = function () {
|
|
107
107
|
return new RTCPeerConnection();
|
|
108
108
|
};
|
|
109
109
|
return DynamicLibHelper;
|
|
@@ -5,5 +5,5 @@ export declare class DynamicLibHelper {
|
|
|
5
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
|
-
getRTCPeerConnection(
|
|
8
|
+
getRTCPeerConnection(): any;
|
|
9
9
|
}
|
|
@@ -102,11 +102,9 @@ var DynamicLibHelper = /** @class */ (function () {
|
|
|
102
102
|
}
|
|
103
103
|
return MediaStream;
|
|
104
104
|
};
|
|
105
|
-
DynamicLibHelper.prototype.getRTCPeerConnection = function (
|
|
105
|
+
DynamicLibHelper.prototype.getRTCPeerConnection = function () {
|
|
106
106
|
try {
|
|
107
|
-
|
|
108
|
-
return new (require("react-native-webrtc").RTCPeerConnection)();
|
|
109
|
-
}
|
|
107
|
+
return new (require("react-native-webrtc").RTCPeerConnection)();
|
|
110
108
|
}
|
|
111
109
|
catch (err) {
|
|
112
110
|
log.error("react-native-webrtc not found. Please do npm install ");
|
|
@@ -5,5 +5,5 @@ export declare class DynamicLibHelper {
|
|
|
5
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
|
-
getRTCPeerConnection(
|
|
8
|
+
getRTCPeerConnection(): any;
|
|
9
9
|
}
|
|
@@ -103,7 +103,7 @@ var DynamicLibHelper = /** @class */ (function () {
|
|
|
103
103
|
}
|
|
104
104
|
return MediaStream;
|
|
105
105
|
};
|
|
106
|
-
DynamicLibHelper.prototype.getRTCPeerConnection = function (
|
|
106
|
+
DynamicLibHelper.prototype.getRTCPeerConnection = function () {
|
|
107
107
|
return new RTCPeerConnection();
|
|
108
108
|
};
|
|
109
109
|
return DynamicLibHelper;
|
|
@@ -18,6 +18,7 @@ export declare abstract class BaseVideoCallHandler extends Base {
|
|
|
18
18
|
abstract createDataChannel(): any;
|
|
19
19
|
abstract sendMessageViaDataChannel(messagePayload: any): any;
|
|
20
20
|
onAllParticipants(participants: Participant[]): Promise<void>;
|
|
21
|
+
onParticipantStartMeetingCalled(participants: Participant): Promise<void>;
|
|
21
22
|
onUserJoined(participants: Participant): Promise<void>;
|
|
22
23
|
onUserLeft(participants: Participant): Promise<void>;
|
|
23
24
|
getConsumerForTrack(track: Track): void;
|
|
@@ -75,6 +75,13 @@ var BaseVideoCallHandler = /** @class */ (function (_super) {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
|
+
BaseVideoCallHandler.prototype.onParticipantStartMeetingCalled = function (participants) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
return [2 /*return*/];
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
78
85
|
BaseVideoCallHandler.prototype.onUserJoined = function (participants) {
|
|
79
86
|
return __awaiter(this, void 0, void 0, function () {
|
|
80
87
|
return __generator(this, function (_a) {
|
|
@@ -406,11 +406,12 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
406
406
|
return __generator(this, function (_f) {
|
|
407
407
|
switch (_f.label) {
|
|
408
408
|
case 0:
|
|
409
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On Send Track - ", this.sendTransport ? true : false);
|
|
409
410
|
if (!this.sendTransport) {
|
|
410
411
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("No Send Transport", track);
|
|
411
412
|
return [2 /*return*/];
|
|
412
413
|
}
|
|
413
|
-
if (!(track && track.track)) return [3 /*break*/,
|
|
414
|
+
if (!(track && track.track)) return [3 /*break*/, 5];
|
|
414
415
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Inside send Track");
|
|
415
416
|
producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
|
|
416
417
|
if (producer && producer.closed === false && ((_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.isMobileApp)) {
|
|
@@ -465,7 +466,11 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
465
466
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("On webcamProducer not created");
|
|
466
467
|
}
|
|
467
468
|
_f.label = 4;
|
|
468
|
-
case 4: return [
|
|
469
|
+
case 4: return [3 /*break*/, 6];
|
|
470
|
+
case 5:
|
|
471
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("Invalid track", track);
|
|
472
|
+
_f.label = 6;
|
|
473
|
+
case 6: return [2 /*return*/];
|
|
469
474
|
}
|
|
470
475
|
});
|
|
471
476
|
});
|
|
@@ -5,9 +5,11 @@ import { BaseVideoCallHandler } from "./BaseVideoCallHandler";
|
|
|
5
5
|
export declare class WebrtcHandler extends BaseVideoCallHandler {
|
|
6
6
|
private dynamicLibHelper;
|
|
7
7
|
onParticipantUpdated(): void;
|
|
8
|
+
onParticipantStartMeetingCalled(participant: Participant): Promise<void>;
|
|
8
9
|
resumeIncomingTrack(track: Track): void;
|
|
9
10
|
pauseIncomingTrack(track: Track): void;
|
|
10
11
|
onSocketMessage(websocketCallHandler: WebSocketMessageBody): void;
|
|
12
|
+
private checkIfCanSendOffer;
|
|
11
13
|
onNewOffer: (data: {
|
|
12
14
|
sdp: string;
|
|
13
15
|
type: string;
|
|
@@ -18,8 +20,16 @@ export declare class WebrtcHandler extends BaseVideoCallHandler {
|
|
|
18
20
|
type: string;
|
|
19
21
|
sender: Participant;
|
|
20
22
|
}) => Promise<void>;
|
|
23
|
+
onIceCandidate: (data: {
|
|
24
|
+
candidate: any;
|
|
25
|
+
type: string;
|
|
26
|
+
sender: Participant;
|
|
27
|
+
}) => Promise<void>;
|
|
28
|
+
subToConnectionState: (remoteParticipant: Participant) => Promise<void>;
|
|
21
29
|
onAllParticipants(participants: Participant[]): Promise<void>;
|
|
22
30
|
onUserJoined(participant: Participant): Promise<void>;
|
|
31
|
+
startSendTrackToPartiipant: (participant: Participant) => Promise<void>;
|
|
32
|
+
sendTrackToParticipant: (track: Track, participant: Participant) => Promise<void>;
|
|
23
33
|
private sendWebrtcMessage;
|
|
24
34
|
init(): Promise<void>;
|
|
25
35
|
onReconnect(): Promise<void>;
|
|
@@ -30,4 +40,5 @@ export declare class WebrtcHandler extends BaseVideoCallHandler {
|
|
|
30
40
|
createDataChannel(): Promise<void>;
|
|
31
41
|
sendMessageViaDataChannel(messagePayload: any): void;
|
|
32
42
|
private isOfferInitParticipant;
|
|
43
|
+
private printLogIfRequired;
|
|
33
44
|
}
|
|
@@ -49,6 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
+
import { Track } from "../model/Track";
|
|
52
53
|
import { WebrtcMessageType } from "../websocket-handler/WebsocketHandler";
|
|
53
54
|
import { BaseVideoCallHandler } from "./BaseVideoCallHandler";
|
|
54
55
|
import log from 'loglevel';
|
|
@@ -59,6 +60,37 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
59
60
|
function WebrtcHandler() {
|
|
60
61
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
61
62
|
_this.dynamicLibHelper = (new DynamicLibHelper());
|
|
63
|
+
_this.checkIfCanSendOffer = function (participant) { return __awaiter(_this, void 0, void 0, function () {
|
|
64
|
+
var selfParticpant, isOfferInitParticipant, peerConnectionObject, peerConnection, offer, messageJson;
|
|
65
|
+
return __generator(this, function (_a) {
|
|
66
|
+
switch (_a.label) {
|
|
67
|
+
case 0:
|
|
68
|
+
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
69
|
+
console.log(selfParticpant);
|
|
70
|
+
if (!(selfParticpant.userId !== participant.userId && !selfParticpant.getPeerConnections().has(participant.userId))) return [3 /*break*/, 2];
|
|
71
|
+
isOfferInitParticipant = this.isOfferInitParticipant(participant);
|
|
72
|
+
if (!!isOfferInitParticipant) return [3 /*break*/, 2];
|
|
73
|
+
peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
|
|
74
|
+
peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection();
|
|
75
|
+
if (!peerConnection) return [3 /*break*/, 2];
|
|
76
|
+
this.subToConnectionState(participant);
|
|
77
|
+
peerConnection.addTransceiver("audio", { direction: "sendrecv" });
|
|
78
|
+
peerConnection.addTransceiver("video", { direction: "sendrecv" });
|
|
79
|
+
return [4 /*yield*/, peerConnection.createOffer()];
|
|
80
|
+
case 1:
|
|
81
|
+
offer = _a.sent();
|
|
82
|
+
peerConnection.setLocalDescription(offer);
|
|
83
|
+
peerConnectionObject.offer = offer;
|
|
84
|
+
peerConnectionObject.rtcPeerConnection = peerConnection;
|
|
85
|
+
// send offer to peer
|
|
86
|
+
console.log("offer", offer);
|
|
87
|
+
messageJson = { to: participant.userId, type: WebrtcMessageType.SendOffer, data: offer };
|
|
88
|
+
this.sendWebrtcMessage(messageJson);
|
|
89
|
+
_a.label = 2;
|
|
90
|
+
case 2: return [2 /*return*/];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}); };
|
|
62
94
|
_this.onNewOffer = function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
63
95
|
var selfParticpant, participant, peerConnectionObject, peerConnection, answer, messageJson;
|
|
64
96
|
return __generator(this, function (_a) {
|
|
@@ -70,8 +102,9 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
70
102
|
if (peerConnectionObject) {
|
|
71
103
|
peerConnectionObject.remoteOffer = data.sdp;
|
|
72
104
|
}
|
|
73
|
-
peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection(
|
|
105
|
+
peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection();
|
|
74
106
|
if (!peerConnection) return [3 /*break*/, 2];
|
|
107
|
+
this.subToConnectionState(participant);
|
|
75
108
|
peerConnection.addTransceiver("audio", { direction: "sendrecv" });
|
|
76
109
|
peerConnection.addTransceiver("video", { direction: "sendrecv" });
|
|
77
110
|
peerConnection.setRemoteDescription({ type: 'offer', sdp: peerConnectionObject.remoteOffer });
|
|
@@ -98,13 +131,102 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
98
131
|
if (peerConnectionObject) {
|
|
99
132
|
peerConnectionObject.remoteAnswer = data.sdp;
|
|
100
133
|
}
|
|
101
|
-
peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection(
|
|
134
|
+
peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection();
|
|
102
135
|
if (peerConnection) {
|
|
103
136
|
peerConnection.setRemoteDescription({ type: 'answer', sdp: peerConnectionObject.remoteAnswer });
|
|
104
137
|
}
|
|
105
138
|
return [2 /*return*/];
|
|
106
139
|
});
|
|
107
140
|
}); };
|
|
141
|
+
_this.onIceCandidate = function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
142
|
+
var selfParticpant, participant, peerConnectionObject, rtcConnection, rtcCandidate;
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
145
|
+
participant = data.sender;
|
|
146
|
+
peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
|
|
147
|
+
rtcConnection = peerConnectionObject.rtcPeerConnection;
|
|
148
|
+
if (rtcConnection) {
|
|
149
|
+
this.printLogIfRequired("on ice candidate", data.candidate);
|
|
150
|
+
rtcCandidate = new RTCIceCandidate({
|
|
151
|
+
candidate: data.candidate.candidate,
|
|
152
|
+
sdpMid: data.candidate.sdpMid,
|
|
153
|
+
sdpMLineIndex: data.candidate.sdpMLineIndex, // don't make it up, you get this in onicecandidate
|
|
154
|
+
});
|
|
155
|
+
rtcConnection.addIceCandidate(rtcCandidate);
|
|
156
|
+
}
|
|
157
|
+
return [2 /*return*/];
|
|
158
|
+
});
|
|
159
|
+
}); };
|
|
160
|
+
_this.subToConnectionState = function (remoteParticipant) { return __awaiter(_this, void 0, void 0, function () {
|
|
161
|
+
var selfParticpant, peerConnectionObject, rtcConnection;
|
|
162
|
+
var _this = this;
|
|
163
|
+
return __generator(this, function (_a) {
|
|
164
|
+
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
165
|
+
peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(remoteParticipant.userId);
|
|
166
|
+
rtcConnection = peerConnectionObject.rtcPeerConnection;
|
|
167
|
+
rtcConnection.addEventListener('icecandidate', function (event) {
|
|
168
|
+
if (event.candidate && event.candidate !== null) {
|
|
169
|
+
_this.printLogIfRequired("icecandidate", event.candidate, remoteParticipant);
|
|
170
|
+
var sdpMid = event.candidate.sdpMid;
|
|
171
|
+
var sdpMLineIndex = event.candidate.sdpMLineIndex;
|
|
172
|
+
var messageJson = { to: remoteParticipant.userId, type: WebrtcMessageType.IceCandidate,
|
|
173
|
+
data: { sdpMid: sdpMid, sdpMLineIndex: sdpMLineIndex, candidate: event.candidate } };
|
|
174
|
+
_this.sendWebrtcMessage(messageJson);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
rtcConnection.addEventListener('iceconnectionstatechange', function (event) {
|
|
178
|
+
_this.printLogIfRequired("iceconnectionstatechange", event, remoteParticipant);
|
|
179
|
+
});
|
|
180
|
+
rtcConnection.addEventListener('connectionstatechange', function (event) {
|
|
181
|
+
if (rtcConnection.connectionState === 'connected') {
|
|
182
|
+
_this.printLogIfRequired("On Connection Change", event, remoteParticipant);
|
|
183
|
+
_this.startSendTrackToPartiipant(remoteParticipant);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
rtcConnection.addEventListener("track", function (onRemoteTrack) {
|
|
187
|
+
var _a, _b;
|
|
188
|
+
if (onRemoteTrack.streams && onRemoteTrack.streams.length > 0) {
|
|
189
|
+
var mediaStream = onRemoteTrack.streams.at(0);
|
|
190
|
+
if (mediaStream.getTracks() && mediaStream.getTracks().length > 0) {
|
|
191
|
+
var streamTrack = mediaStream.getTracks().at(0);
|
|
192
|
+
var track = new Track(remoteParticipant, false, streamTrack.kind, streamTrack);
|
|
193
|
+
(_a = _this.communicationHandler) === null || _a === void 0 ? void 0 : _a.addUpdateRemoteTrack(track, remoteParticipant, true);
|
|
194
|
+
_this.printLogIfRequired("New Remote Track", track);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else if (onRemoteTrack.track) {
|
|
198
|
+
var streamTrack = onRemoteTrack.track;
|
|
199
|
+
var track = new Track(remoteParticipant, false, streamTrack.kind, streamTrack);
|
|
200
|
+
(_b = _this.communicationHandler) === null || _b === void 0 ? void 0 : _b.addUpdateRemoteTrack(track, remoteParticipant, true);
|
|
201
|
+
_this.printLogIfRequired("New Remote Track", track);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return [2 /*return*/];
|
|
205
|
+
});
|
|
206
|
+
}); };
|
|
207
|
+
_this.startSendTrackToPartiipant = function (participant) { return __awaiter(_this, void 0, void 0, function () {
|
|
208
|
+
var _this = this;
|
|
209
|
+
return __generator(this, function (_a) {
|
|
210
|
+
this.communicationHandler.getAllSelfTracks().forEach(function (eachTrack) {
|
|
211
|
+
_this.sendTrackToParticipant(eachTrack, participant);
|
|
212
|
+
});
|
|
213
|
+
return [2 /*return*/];
|
|
214
|
+
});
|
|
215
|
+
}); };
|
|
216
|
+
_this.sendTrackToParticipant = function (track, participant) { return __awaiter(_this, void 0, void 0, function () {
|
|
217
|
+
var selfParticpant, peerConnection;
|
|
218
|
+
return __generator(this, function (_a) {
|
|
219
|
+
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
220
|
+
if (selfParticpant) {
|
|
221
|
+
peerConnection = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
|
|
222
|
+
if (peerConnection && peerConnection.rtcPeerConnection) {
|
|
223
|
+
this.printLogIfRequired("Send Track");
|
|
224
|
+
peerConnection.rtcPeerConnection.addTrack(track.track);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return [2 /*return*/];
|
|
228
|
+
});
|
|
229
|
+
}); };
|
|
108
230
|
_this.sendWebrtcMessage = function (data) {
|
|
109
231
|
_this.communicationHandler.sendWebSocketMessage(WebrtcMessageType.WebrtcMessage, data);
|
|
110
232
|
};
|
|
@@ -115,16 +237,41 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
115
237
|
}
|
|
116
238
|
return false;
|
|
117
239
|
};
|
|
240
|
+
_this.printLogIfRequired = function (message) {
|
|
241
|
+
var optionalParams = [];
|
|
242
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
243
|
+
optionalParams[_i - 1] = arguments[_i];
|
|
244
|
+
}
|
|
245
|
+
if (optionalParams && optionalParams.length > 0) {
|
|
246
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log(message, optionalParams);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && console.log(message);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
118
252
|
return _this;
|
|
119
253
|
}
|
|
120
254
|
WebrtcHandler.prototype.onParticipantUpdated = function () {
|
|
121
255
|
console.log("onParticipantUpdated");
|
|
122
256
|
// throw new Error("Method not implemented.");
|
|
123
257
|
};
|
|
258
|
+
WebrtcHandler.prototype.onParticipantStartMeetingCalled = function (participant) {
|
|
259
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
260
|
+
return __generator(this, function (_a) {
|
|
261
|
+
this.onUserJoined(participant);
|
|
262
|
+
return [2 /*return*/];
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
};
|
|
124
266
|
WebrtcHandler.prototype.resumeIncomingTrack = function (track) {
|
|
125
|
-
|
|
267
|
+
if (track.track) {
|
|
268
|
+
track.track.enabled = true;
|
|
269
|
+
}
|
|
126
270
|
};
|
|
127
271
|
WebrtcHandler.prototype.pauseIncomingTrack = function (track) {
|
|
272
|
+
if (track.track) {
|
|
273
|
+
track.track.enabled = false;
|
|
274
|
+
}
|
|
128
275
|
// throw new Error("Method not implemented.");
|
|
129
276
|
};
|
|
130
277
|
WebrtcHandler.prototype.onSocketMessage = function (websocketCallHandler) {
|
|
@@ -149,56 +296,44 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
149
296
|
else if (websocketCallHandler.type === WebrtcMessageType.SendAnswer) {
|
|
150
297
|
this.onNewAnswer(data);
|
|
151
298
|
}
|
|
299
|
+
else if (websocketCallHandler.type === WebrtcMessageType.IceCandidate) {
|
|
300
|
+
this.onIceCandidate(data);
|
|
301
|
+
}
|
|
152
302
|
// throw new Error("Method not implemented.");
|
|
153
303
|
};
|
|
154
304
|
WebrtcHandler.prototype.onAllParticipants = function (participants) {
|
|
155
305
|
return __awaiter(this, void 0, void 0, function () {
|
|
306
|
+
var selfParticpant;
|
|
156
307
|
var _this = this;
|
|
157
308
|
return __generator(this, function (_a) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
309
|
+
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
310
|
+
if (selfParticpant.isStartMeetingCalled) {
|
|
311
|
+
participants.forEach(function (eachParticiapant) {
|
|
312
|
+
_this.onUserJoined(eachParticiapant);
|
|
313
|
+
});
|
|
314
|
+
}
|
|
161
315
|
return [2 /*return*/];
|
|
162
316
|
});
|
|
163
317
|
});
|
|
164
318
|
};
|
|
165
319
|
WebrtcHandler.prototype.onUserJoined = function (participant) {
|
|
166
320
|
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
-
var selfParticpant, isOfferInitParticipant, peerConnectionObject, peerConnection, offer, messageJson;
|
|
168
321
|
return __generator(this, function (_a) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
172
|
-
console.log(selfParticpant);
|
|
173
|
-
if (!(selfParticpant.userId !== participant.userId && !selfParticpant.getPeerConnections().has(participant.userId))) return [3 /*break*/, 2];
|
|
174
|
-
console.log("onUserJoined ", participant);
|
|
175
|
-
isOfferInitParticipant = this.isOfferInitParticipant(participant);
|
|
176
|
-
if (!!isOfferInitParticipant) return [3 /*break*/, 2];
|
|
177
|
-
peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
|
|
178
|
-
peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection(this.meetingStartRequest);
|
|
179
|
-
if (!peerConnection) return [3 /*break*/, 2];
|
|
180
|
-
peerConnection.addTransceiver("audio", { direction: "sendrecv" });
|
|
181
|
-
peerConnection.addTransceiver("video", { direction: "sendrecv" });
|
|
182
|
-
return [4 /*yield*/, peerConnection.createOffer()];
|
|
183
|
-
case 1:
|
|
184
|
-
offer = _a.sent();
|
|
185
|
-
peerConnection.setLocalDescription(offer);
|
|
186
|
-
peerConnectionObject.offer = offer;
|
|
187
|
-
peerConnectionObject.rtcPeerConnection = peerConnection;
|
|
188
|
-
// send offer to peer
|
|
189
|
-
console.log("offer", offer);
|
|
190
|
-
messageJson = { to: participant.userId, type: WebrtcMessageType.SendOffer, data: offer };
|
|
191
|
-
this.sendWebrtcMessage(messageJson);
|
|
192
|
-
_a.label = 2;
|
|
193
|
-
case 2: return [2 /*return*/];
|
|
322
|
+
if (participant.isStartMeetingCalled) {
|
|
323
|
+
this.checkIfCanSendOffer(participant);
|
|
194
324
|
}
|
|
325
|
+
return [2 /*return*/];
|
|
195
326
|
});
|
|
196
327
|
});
|
|
197
328
|
};
|
|
198
329
|
WebrtcHandler.prototype.init = function () {
|
|
199
330
|
return __awaiter(this, void 0, void 0, function () {
|
|
331
|
+
var _this = this;
|
|
200
332
|
return __generator(this, function (_a) {
|
|
201
333
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Webrtc Init");
|
|
334
|
+
this.communicationHandler.getAllParticipants().forEach(function (eachParticiapant) {
|
|
335
|
+
_this.onUserJoined(eachParticiapant);
|
|
336
|
+
});
|
|
202
337
|
return [2 /*return*/];
|
|
203
338
|
});
|
|
204
339
|
});
|
|
@@ -207,16 +342,24 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
207
342
|
throw new Error("Method not implemented.");
|
|
208
343
|
};
|
|
209
344
|
WebrtcHandler.prototype.stopTrack = function (track) {
|
|
345
|
+
if (track.track) {
|
|
346
|
+
track.track.enabled = false;
|
|
347
|
+
}
|
|
210
348
|
// throw new Error("Method not implemented.");
|
|
211
349
|
};
|
|
212
350
|
WebrtcHandler.prototype.pauseTrack = function (track) {
|
|
351
|
+
if (track.track) {
|
|
352
|
+
track.track.enabled = false;
|
|
353
|
+
}
|
|
213
354
|
// throw new Error("Method not implemented.");
|
|
214
355
|
};
|
|
215
356
|
WebrtcHandler.prototype.resumeTrack = function (track) {
|
|
357
|
+
if (track.track) {
|
|
358
|
+
track.track.enabled = true;
|
|
359
|
+
}
|
|
216
360
|
// throw new Error("Method not implemented.");
|
|
217
361
|
};
|
|
218
362
|
WebrtcHandler.prototype.sendTrack = function (track) {
|
|
219
|
-
// throw new Error("Method not implemented.");
|
|
220
363
|
};
|
|
221
364
|
WebrtcHandler.prototype.createDataChannel = function () {
|
|
222
365
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8,6 +8,7 @@ export declare enum WebSocketBasicEvents {
|
|
|
8
8
|
CloseRoomForceFully = "CloseRoomForceFully",
|
|
9
9
|
AudioVideoPauseResume = "audioVideoPauseResume",
|
|
10
10
|
OnStartMeetingCalled = "startMeetingCalled",
|
|
11
|
+
OnStartParticipantMeetingCalled = "OnStartParticipantMeetingCalled",
|
|
11
12
|
OnAudioVideoPauseResume = "audioVideoPauseResume",
|
|
12
13
|
OnAudioVideoStatusUpdated = "audioVideoStatusUpdated",
|
|
13
14
|
OnAudioUnblockRequest = "audioUnblock",
|
|
@@ -32,6 +33,7 @@ export declare enum WebSocketBasicEvents {
|
|
|
32
33
|
}
|
|
33
34
|
export declare enum WebrtcMessageType {
|
|
34
35
|
SendOffer = "SendOffer",
|
|
36
|
+
IceCandidate = "IceCandidate",
|
|
35
37
|
WebrtcMessage = "WebrtcMessage",
|
|
36
38
|
SendAnswer = "SendAnswer"
|
|
37
39
|
}
|
|
@@ -63,6 +63,7 @@ export var WebSocketBasicEvents;
|
|
|
63
63
|
WebSocketBasicEvents["CloseRoomForceFully"] = "CloseRoomForceFully";
|
|
64
64
|
WebSocketBasicEvents["AudioVideoPauseResume"] = "audioVideoPauseResume";
|
|
65
65
|
WebSocketBasicEvents["OnStartMeetingCalled"] = "startMeetingCalled";
|
|
66
|
+
WebSocketBasicEvents["OnStartParticipantMeetingCalled"] = "OnStartParticipantMeetingCalled";
|
|
66
67
|
WebSocketBasicEvents["OnAudioVideoPauseResume"] = "audioVideoPauseResume";
|
|
67
68
|
WebSocketBasicEvents["OnAudioVideoStatusUpdated"] = "audioVideoStatusUpdated";
|
|
68
69
|
WebSocketBasicEvents["OnAudioUnblockRequest"] = "audioUnblock";
|
|
@@ -88,6 +89,7 @@ export var WebSocketBasicEvents;
|
|
|
88
89
|
export var WebrtcMessageType;
|
|
89
90
|
(function (WebrtcMessageType) {
|
|
90
91
|
WebrtcMessageType["SendOffer"] = "SendOffer";
|
|
92
|
+
WebrtcMessageType["IceCandidate"] = "IceCandidate";
|
|
91
93
|
WebrtcMessageType["WebrtcMessage"] = "WebrtcMessage";
|
|
92
94
|
WebrtcMessageType["SendAnswer"] = "SendAnswer";
|
|
93
95
|
})(WebrtcMessageType || (WebrtcMessageType = {}));
|
|
@@ -485,7 +487,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
485
487
|
}, 300);
|
|
486
488
|
};
|
|
487
489
|
WebsocketHandler.prototype.onMessage = function (message) {
|
|
488
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
490
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
489
491
|
this.lastPingTimeStamp = new Date().getTime();
|
|
490
492
|
// this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("lastPingTimeStamp time ", this.lastPingTimeStamp)
|
|
491
493
|
var messagejson = JSON.parse(message);
|
|
@@ -505,36 +507,39 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
505
507
|
else if (type === WebSocketBasicEvents.IsSetupDone) {
|
|
506
508
|
this.onSetupDone(data);
|
|
507
509
|
}
|
|
510
|
+
else if (type === WebSocketBasicEvents.OnStartParticipantMeetingCalled) {
|
|
511
|
+
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.onStartParticipantMeetingCalled((_d = data === null || data === void 0 ? void 0 : data.message) === null || _d === void 0 ? void 0 : _d.participant);
|
|
512
|
+
}
|
|
508
513
|
else if (type === WebSocketBasicEvents.CloseRoomForceFully) {
|
|
509
514
|
this.onCloseTheRoomForcefully(data);
|
|
510
515
|
}
|
|
511
516
|
else if (type === WebSocketBasicEvents.OnUserOnFoundWhileReconnect) {
|
|
512
|
-
(
|
|
517
|
+
(_e = this.communicationHandler) === null || _e === void 0 ? void 0 : _e.emitMessageToSource(VaniEvent.OnUserOnFoundWhileReconnect, {});
|
|
513
518
|
}
|
|
514
519
|
else if (type === WebSocketBasicEvents.OnNewJoinee || type === WebSocketBasicEvents.OnRejoined) {
|
|
515
520
|
if (data && data.message && data.message.participant) {
|
|
516
521
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("OnParticipantUpdated from server", data.message.participant);
|
|
517
|
-
(
|
|
522
|
+
(_f = this.communicationHandler) === null || _f === void 0 ? void 0 : _f.addParticipantIfNotExist(data.message.participant, true);
|
|
518
523
|
}
|
|
519
524
|
}
|
|
520
525
|
else if (type === WebSocketBasicEvents.OnParticipantUpdated) {
|
|
521
526
|
if (data) {
|
|
522
527
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && console.log("WebSocketBasicEvents.OnParticipantUpdated", data.message);
|
|
523
|
-
(
|
|
528
|
+
(_g = this.communicationHandler) === null || _g === void 0 ? void 0 : _g.addParticipantIfNotExist(data.message, true);
|
|
524
529
|
}
|
|
525
530
|
}
|
|
526
531
|
else if (type === WebSocketBasicEvents.OnUserLeft) {
|
|
527
|
-
(
|
|
532
|
+
(_h = this.communicationHandler) === null || _h === void 0 ? void 0 : _h.onUserLeft(data);
|
|
528
533
|
}
|
|
529
534
|
else if (type === WebSocketBasicEvents.OnServerParticipants) {
|
|
530
|
-
(
|
|
535
|
+
(_j = this.communicationHandler) === null || _j === void 0 ? void 0 : _j.onServerParticipants(data);
|
|
531
536
|
}
|
|
532
537
|
else if (type === WebSocketBasicEvents.OnOldMessages) {
|
|
533
|
-
(
|
|
538
|
+
(_k = this.communicationHandler) === null || _k === void 0 ? void 0 : _k.onOldMessages(data);
|
|
534
539
|
}
|
|
535
540
|
else if (type === WebSocketBasicEvents.OnChat) {
|
|
536
541
|
if (data.message) {
|
|
537
|
-
(
|
|
542
|
+
(_l = this.communicationHandler) === null || _l === void 0 ? void 0 : _l.onMessage(data.message);
|
|
538
543
|
}
|
|
539
544
|
}
|
|
540
545
|
else if (type === WebSocketBasicEvents.OnMeetingStartTime) {
|
|
@@ -543,23 +548,23 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
543
548
|
if (time > new Date().getTime()) {
|
|
544
549
|
time = new Date().getTime();
|
|
545
550
|
}
|
|
546
|
-
(
|
|
551
|
+
(_m = this.communicationHandler) === null || _m === void 0 ? void 0 : _m.emitMessageToSource(VaniEvent.OnMeetingStartTime, (time + ""));
|
|
547
552
|
}
|
|
548
553
|
}
|
|
549
554
|
else if (type === WebSocketBasicEvents.OnAudioVideoStatusUpdated) {
|
|
550
|
-
(
|
|
555
|
+
(_o = this.communicationHandler) === null || _o === void 0 ? void 0 : _o.onAudioVideoStatusUpdated(data);
|
|
551
556
|
}
|
|
552
557
|
else if (type === WebSocketBasicEvents.OnAudioBlockRequest) {
|
|
553
|
-
(
|
|
558
|
+
(_p = this.communicationHandler) === null || _p === void 0 ? void 0 : _p.onAudioBlocked(data);
|
|
554
559
|
}
|
|
555
560
|
else if (type === WebSocketBasicEvents.OnAudioUnblockRequest) {
|
|
556
|
-
(
|
|
561
|
+
(_q = this.communicationHandler) === null || _q === void 0 ? void 0 : _q.onAudioUnblocked(data);
|
|
557
562
|
}
|
|
558
563
|
else if (type === WebSocketBasicEvents.OnVideoBlockRequest) {
|
|
559
|
-
(
|
|
564
|
+
(_r = this.communicationHandler) === null || _r === void 0 ? void 0 : _r.onVideoBlocked(data);
|
|
560
565
|
}
|
|
561
566
|
else if (type === WebSocketBasicEvents.OnVideoUnblockRequest) {
|
|
562
|
-
(
|
|
567
|
+
(_s = this.communicationHandler) === null || _s === void 0 ? void 0 : _s.onVideoUnblocked(data);
|
|
563
568
|
}
|
|
564
569
|
}
|
|
565
570
|
};
|