vani-meeting-client-native 0.4.6-beta2 → 0.4.6-beta4
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.
|
@@ -17,6 +17,7 @@ export declare class Participant {
|
|
|
17
17
|
private peerConnections;
|
|
18
18
|
getPeerConnections: () => Map<string, PeerConnection>;
|
|
19
19
|
isPeerConnectionsViaUserIdPresent: (userId: string) => PeerConnection;
|
|
20
|
+
removePeerConnectionsViaUserId: (userId: string) => boolean;
|
|
20
21
|
getPeerConnectionsViaUserId: (userId: string, meetingStartRequest: MeetingStartRequest) => PeerConnection;
|
|
21
22
|
constructor(_userId: string, _roomId: string, _userData?: any, _isAdmin?: boolean);
|
|
22
23
|
}
|
package/lib/model/Participant.js
CHANGED
|
@@ -25,6 +25,9 @@ var Participant = /** @class */ (function () {
|
|
|
25
25
|
this.isPeerConnectionsViaUserIdPresent = function (userId) {
|
|
26
26
|
return _this.getPeerConnections().get(userId);
|
|
27
27
|
};
|
|
28
|
+
this.removePeerConnectionsViaUserId = function (userId) {
|
|
29
|
+
return _this.getPeerConnections().delete(userId);
|
|
30
|
+
};
|
|
28
31
|
this.getPeerConnectionsViaUserId = function (userId, meetingStartRequest) {
|
|
29
32
|
if (!_this.getPeerConnections().has(userId)) {
|
|
30
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>;
|
|
@@ -273,7 +273,7 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
273
273
|
this.printLogIfRequired("loopSendOffer", "Not found", selfParticpant, participant);
|
|
274
274
|
return [2 /*return*/];
|
|
275
275
|
}
|
|
276
|
-
this.printLogIfRequired("Send Offer", mungedOffer, participant);
|
|
276
|
+
this.printLogIfRequired("Send Offer loop", mungedOffer, participant);
|
|
277
277
|
messageJson = { to: participant.userId, type: WebrtcMessageType.SendOffer, data: mungedOffer };
|
|
278
278
|
this.sendWebrtcMessage(messageJson);
|
|
279
279
|
if (peerConnectionObject.remoteAnswer || count > 20) {
|
|
@@ -714,11 +714,12 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
714
714
|
}); };
|
|
715
715
|
_this.sendTrackToParticipant = function (track, participant) { return __awaiter(_this, void 0, void 0, function () {
|
|
716
716
|
var selfParticpant, peerConnection;
|
|
717
|
-
|
|
717
|
+
var _a;
|
|
718
|
+
return __generator(this, function (_b) {
|
|
718
719
|
if (!track.track) {
|
|
719
720
|
return [2 /*return*/];
|
|
720
721
|
}
|
|
721
|
-
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
722
|
+
selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
722
723
|
if (selfParticpant) {
|
|
723
724
|
peerConnection = selfParticpant.getPeerConnectionsViaUserId(participant.userId, this.meetingStartRequest);
|
|
724
725
|
if (peerConnection && peerConnection.rtcPeerConnection && peerConnection.rtcPeerConnection.signalingState === 'stable') {
|
|
@@ -987,12 +988,13 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
987
988
|
// throw new Error("Method not implemented.");
|
|
988
989
|
};
|
|
989
990
|
WebrtcHandler.prototype.onAllParticipants = function (participants) {
|
|
991
|
+
var _a;
|
|
990
992
|
return __awaiter(this, void 0, void 0, function () {
|
|
991
993
|
var selfParticpant;
|
|
992
994
|
var _this = this;
|
|
993
|
-
return __generator(this, function (
|
|
994
|
-
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
995
|
-
if (selfParticpant.isStartMeetingCalled) {
|
|
995
|
+
return __generator(this, function (_b) {
|
|
996
|
+
selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
997
|
+
if (selfParticpant && selfParticpant.isStartMeetingCalled) {
|
|
996
998
|
participants.forEach(function (eachParticiapant) {
|
|
997
999
|
_this.onUserJoined(eachParticiapant);
|
|
998
1000
|
});
|
|
@@ -1001,6 +1003,28 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
1001
1003
|
});
|
|
1002
1004
|
});
|
|
1003
1005
|
};
|
|
1006
|
+
WebrtcHandler.prototype.onUserLeft = function (participant) {
|
|
1007
|
+
var _a;
|
|
1008
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1009
|
+
var selfParticpant, peerConnection;
|
|
1010
|
+
return __generator(this, function (_b) {
|
|
1011
|
+
try {
|
|
1012
|
+
selfParticpant = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfParticipant();
|
|
1013
|
+
if (selfParticpant) {
|
|
1014
|
+
peerConnection = selfParticpant.isPeerConnectionsViaUserIdPresent(participant.userId);
|
|
1015
|
+
if (peerConnection) {
|
|
1016
|
+
peerConnection.rtcPeerConnection.close();
|
|
1017
|
+
selfParticpant.removePeerConnectionsViaUserId(participant.userId);
|
|
1018
|
+
this.printLogIfRequired("onUserLeft after", selfParticpant.getPeerConnections());
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
catch (err) {
|
|
1023
|
+
}
|
|
1024
|
+
return [2 /*return*/];
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1027
|
+
};
|
|
1004
1028
|
WebrtcHandler.prototype.onUserJoined = function (participant) {
|
|
1005
1029
|
return __awaiter(this, void 0, void 0, function () {
|
|
1006
1030
|
return __generator(this, function (_a) {
|