vani-meeting-client 2.3.7 → 2.3.8
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.js +2 -0
- package/lib/model/Participant.d.ts +2 -0
- package/lib/model/Participant.js +6 -0
- package/lib/video-call-handler/WebrtcHandler.d.ts +1 -0
- package/lib/video-call-handler/WebrtcHandler.js +44 -19
- package/lib/websocket-handler/WebsocketHandler.js +2 -0
- package/package.json +1 -1
|
@@ -573,6 +573,8 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
573
573
|
CommunicationHandler.prototype.sendWebSocketMessage = function (type, data) {
|
|
574
574
|
var _a;
|
|
575
575
|
(_a = this.websocketCallHandler) === null || _a === void 0 ? void 0 : _a.sendSocketMessage(type, data);
|
|
576
|
+
// this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug &&
|
|
577
|
+
// console.log("sendSocketMessage",type,data)
|
|
576
578
|
};
|
|
577
579
|
// public sendWebSocketMessageForWebrtc(type: WebrtcMessageType, data: any, to : string) {
|
|
578
580
|
// this.websocketCallHandler?.sendSocketMessage(type, data)
|
|
@@ -16,6 +16,8 @@ export declare class Participant {
|
|
|
16
16
|
isRecordingUser: boolean;
|
|
17
17
|
private peerConnections;
|
|
18
18
|
getPeerConnections: () => Map<string, PeerConnection>;
|
|
19
|
+
isPeerConnectionsViaUserIdPresent: (userId: string) => PeerConnection;
|
|
20
|
+
removePeerConnectionsViaUserId: (userId: string) => boolean;
|
|
19
21
|
getPeerConnectionsViaUserId: (userId: string, meetingStartRequest: MeetingStartRequest) => PeerConnection;
|
|
20
22
|
constructor(_userId: string, _roomId: string, _userData?: any, _isAdmin?: boolean);
|
|
21
23
|
}
|
package/lib/model/Participant.js
CHANGED
|
@@ -22,6 +22,12 @@ var Participant = /** @class */ (function () {
|
|
|
22
22
|
}
|
|
23
23
|
return _this.peerConnections;
|
|
24
24
|
};
|
|
25
|
+
this.isPeerConnectionsViaUserIdPresent = function (userId) {
|
|
26
|
+
return _this.getPeerConnections().get(userId);
|
|
27
|
+
};
|
|
28
|
+
this.removePeerConnectionsViaUserId = function (userId) {
|
|
29
|
+
return _this.getPeerConnections().delete(userId);
|
|
30
|
+
};
|
|
25
31
|
this.getPeerConnectionsViaUserId = function (userId, meetingStartRequest) {
|
|
26
32
|
if (!_this.getPeerConnections().has(userId)) {
|
|
27
33
|
var peerConnection = new PeerConnection();
|
|
@@ -42,6 +42,7 @@ export declare class WebrtcHandler extends BaseVideoCallHandler {
|
|
|
42
42
|
subToConnectionState: (remoteParticipant: Participant) => Promise<void>;
|
|
43
43
|
onNegotiationNeeded: (remoteParticipant: Participant, shouldRestartIce?: boolean, count?: number, shouldForceFullyCreateOffer?: boolean) => Promise<void>;
|
|
44
44
|
onAllParticipants(participants: Participant[]): Promise<void>;
|
|
45
|
+
onUserLeft(participant: Participant): Promise<void>;
|
|
45
46
|
onUserJoined(participant: Participant): Promise<void>;
|
|
46
47
|
startSendTrackToPartiipant: (participant: Participant) => Promise<void>;
|
|
47
48
|
sendTrackToParticipant: (track: Track, participant: Participant) => Promise<void>;
|
|
@@ -162,11 +162,6 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
162
162
|
else if (realTrack.track.kind === 'video') {
|
|
163
163
|
newTransceiver = peerConnection.rtcPeerConnection.addTransceiver(realTrack.track, {
|
|
164
164
|
direction: 'sendonly',
|
|
165
|
-
sendEncodings: [{
|
|
166
|
-
maxBitrate: 500000,
|
|
167
|
-
priority: 'low',
|
|
168
|
-
networkPriority: 'low',
|
|
169
|
-
}]
|
|
170
165
|
});
|
|
171
166
|
}
|
|
172
167
|
// newTransceiver = await peerConnection.rtcPeerConnection.addTransceiver(realTrack.track, { direction: "sendrecv" })
|
|
@@ -266,10 +261,19 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
266
261
|
_this.loopSendOffer = function (peerConnectionObject, participant, mungedOffer, count) {
|
|
267
262
|
if (count === void 0) { count = 0; }
|
|
268
263
|
return __awaiter(_this, void 0, void 0, function () {
|
|
269
|
-
var messageJson;
|
|
264
|
+
var selfParticpant, messageJson;
|
|
270
265
|
var _this = this;
|
|
271
|
-
|
|
272
|
-
|
|
266
|
+
var _a;
|
|
267
|
+
return __generator(this, function (_b) {
|
|
268
|
+
selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
269
|
+
if (!selfParticpant) {
|
|
270
|
+
return [2 /*return*/];
|
|
271
|
+
}
|
|
272
|
+
if (!selfParticpant.isPeerConnectionsViaUserIdPresent(participant.userId)) {
|
|
273
|
+
this.printLogIfRequired("loopSendOffer", "Not found", selfParticpant, participant);
|
|
274
|
+
return [2 /*return*/];
|
|
275
|
+
}
|
|
276
|
+
this.printLogIfRequired("Send Offer loop", mungedOffer, participant);
|
|
273
277
|
messageJson = { to: participant.userId, type: WebrtcMessageType.SendOffer, data: mungedOffer };
|
|
274
278
|
this.sendWebrtcMessage(messageJson);
|
|
275
279
|
if (peerConnectionObject.remoteAnswer || count > 20) {
|
|
@@ -710,11 +714,12 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
710
714
|
}); };
|
|
711
715
|
_this.sendTrackToParticipant = function (track, participant) { return __awaiter(_this, void 0, void 0, function () {
|
|
712
716
|
var selfParticpant, peerConnection;
|
|
713
|
-
|
|
717
|
+
var _a;
|
|
718
|
+
return __generator(this, function (_b) {
|
|
714
719
|
if (!track.track) {
|
|
715
720
|
return [2 /*return*/];
|
|
716
721
|
}
|
|
717
|
-
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
722
|
+
selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
718
723
|
if (selfParticpant) {
|
|
719
724
|
peerConnection = selfParticpant.getPeerConnectionsViaUserId(participant.userId, this.meetingStartRequest);
|
|
720
725
|
if (peerConnection && peerConnection.rtcPeerConnection && peerConnection.rtcPeerConnection.signalingState === 'stable') {
|
|
@@ -832,13 +837,10 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
832
837
|
transceiver.sender.setParameters(params).catch(console.error);
|
|
833
838
|
};
|
|
834
839
|
_this.onNewTrack = function (track, receiver, transceiver, remoteParticipant) { return __awaiter(_this, void 0, void 0, function () {
|
|
835
|
-
var kind
|
|
836
|
-
|
|
837
|
-
return __generator(this, function (_b) {
|
|
838
|
-
this.printLogIfRequired('ontrack fired', track.kind, track.id);
|
|
840
|
+
var kind;
|
|
841
|
+
return __generator(this, function (_a) {
|
|
839
842
|
kind = track.kind.toLowerCase() === 'audio' ? TrackKind.Audio : TrackKind.Video;
|
|
840
|
-
|
|
841
|
-
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.addUpdateRemoteTrack(t, remoteParticipant, true);
|
|
843
|
+
this.registerTrack(track, remoteParticipant, kind);
|
|
842
844
|
return [2 /*return*/];
|
|
843
845
|
});
|
|
844
846
|
}); };
|
|
@@ -983,12 +985,13 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
983
985
|
// throw new Error("Method not implemented.");
|
|
984
986
|
};
|
|
985
987
|
WebrtcHandler.prototype.onAllParticipants = function (participants) {
|
|
988
|
+
var _a;
|
|
986
989
|
return __awaiter(this, void 0, void 0, function () {
|
|
987
990
|
var selfParticpant;
|
|
988
991
|
var _this = this;
|
|
989
|
-
return __generator(this, function (
|
|
990
|
-
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
991
|
-
if (selfParticpant.isStartMeetingCalled) {
|
|
992
|
+
return __generator(this, function (_b) {
|
|
993
|
+
selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
994
|
+
if (selfParticpant && selfParticpant.isStartMeetingCalled) {
|
|
992
995
|
participants.forEach(function (eachParticiapant) {
|
|
993
996
|
_this.onUserJoined(eachParticiapant);
|
|
994
997
|
});
|
|
@@ -997,6 +1000,28 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
997
1000
|
});
|
|
998
1001
|
});
|
|
999
1002
|
};
|
|
1003
|
+
WebrtcHandler.prototype.onUserLeft = function (participant) {
|
|
1004
|
+
var _a;
|
|
1005
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1006
|
+
var selfParticpant, peerConnection;
|
|
1007
|
+
return __generator(this, function (_b) {
|
|
1008
|
+
try {
|
|
1009
|
+
selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
1010
|
+
if (selfParticpant) {
|
|
1011
|
+
peerConnection = selfParticpant.isPeerConnectionsViaUserIdPresent(participant.userId);
|
|
1012
|
+
if (peerConnection) {
|
|
1013
|
+
peerConnection.rtcPeerConnection.close();
|
|
1014
|
+
selfParticpant.removePeerConnectionsViaUserId(participant.userId);
|
|
1015
|
+
this.printLogIfRequired("onUserLeft after", selfParticpant.getPeerConnections());
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
catch (err) {
|
|
1020
|
+
}
|
|
1021
|
+
return [2 /*return*/];
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
};
|
|
1000
1025
|
WebrtcHandler.prototype.onUserJoined = function (participant) {
|
|
1001
1026
|
return __awaiter(this, void 0, void 0, function () {
|
|
1002
1027
|
return __generator(this, function (_a) {
|
|
@@ -373,6 +373,8 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
373
373
|
if (this.isWebScoketConnectedWithoutSetup()) {
|
|
374
374
|
var paylod = { type: type, data: data };
|
|
375
375
|
(_a = this.wss) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify(paylod));
|
|
376
|
+
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug &&
|
|
377
|
+
console.log("sendSocketMessage", type, JSON.stringify(paylod));
|
|
376
378
|
// console.log("sendSocketMessage",type,data)
|
|
377
379
|
}
|
|
378
380
|
};
|