vani-meeting-client 2.2.3-beta → 2.2.3-beta2
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.js +0 -1
- package/lib/model/Participant.d.ts +2 -1
- package/lib/model/Participant.js +7 -0
- package/lib/video-call-handler/WebrtcHandler.d.ts +1 -0
- package/lib/video-call-handler/WebrtcHandler.js +13 -5
- package/lib/websocket-handler/WebsocketHandler.js +0 -2
- package/package.json +1 -1
package/lib/MeetingHandler.js
CHANGED
|
@@ -483,7 +483,6 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
483
483
|
MeetingHandler.prototype.checkSocket = function () {
|
|
484
484
|
return __awaiter(this, void 0, void 0, function () {
|
|
485
485
|
return __generator(this, function (_a) {
|
|
486
|
-
debugger;
|
|
487
486
|
if (!this.meetingStartRequest) {
|
|
488
487
|
log.error("meetingStartRequestObject not found");
|
|
489
488
|
return [2 /*return*/, false];
|
|
@@ -13,6 +13,7 @@ export declare class Participant {
|
|
|
13
13
|
isAudioEnable: boolean;
|
|
14
14
|
isStartMeetingCalled: boolean;
|
|
15
15
|
isRecordingUser: boolean;
|
|
16
|
-
peerConnections
|
|
16
|
+
private peerConnections;
|
|
17
|
+
getPeerConnections: () => Map<string, PeerConnection>;
|
|
17
18
|
constructor(_userId: string, _roomId: string, _userData?: any, _isAdmin?: boolean);
|
|
18
19
|
}
|
package/lib/model/Participant.js
CHANGED
|
@@ -2,6 +2,7 @@ var Participant = /** @class */ (function () {
|
|
|
2
2
|
function Participant(_userId, _roomId, _userData, _isAdmin) {
|
|
3
3
|
if (_userData === void 0) { _userData = {}; }
|
|
4
4
|
if (_isAdmin === void 0) { _isAdmin = false; }
|
|
5
|
+
var _this = this;
|
|
5
6
|
this.isAdmin = false;
|
|
6
7
|
this.isAudioBlockedByAdmin = false;
|
|
7
8
|
this.isVideoBlockedByAdmin = false;
|
|
@@ -13,6 +14,12 @@ var Participant = /** @class */ (function () {
|
|
|
13
14
|
this.isStartMeetingCalled = false;
|
|
14
15
|
this.isRecordingUser = false;
|
|
15
16
|
this.peerConnections = new Map();
|
|
17
|
+
this.getPeerConnections = function () {
|
|
18
|
+
if (!_this.peerConnections) {
|
|
19
|
+
_this.peerConnections = new Map();
|
|
20
|
+
}
|
|
21
|
+
return _this.peerConnections;
|
|
22
|
+
};
|
|
16
23
|
this.userId = _userId;
|
|
17
24
|
this.roomId = _roomId;
|
|
18
25
|
this.userData = _userData;
|
|
@@ -10,6 +10,7 @@ export declare class WebrtcHandler extends BaseVideoCallHandler {
|
|
|
10
10
|
onSocketMessage(websocketCallHandler: WebSocketMessageBody): void;
|
|
11
11
|
onAllParticipants(participants: Participant[]): Promise<void>;
|
|
12
12
|
onUserJoined(participant: Participant): Promise<void>;
|
|
13
|
+
private sendWebrtcMessage;
|
|
13
14
|
init(): Promise<void>;
|
|
14
15
|
onReconnect(): Promise<void>;
|
|
15
16
|
stopTrack(track: Track): void;
|
|
@@ -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 { WebrtcMessageType } from "../websocket-handler/WebsocketHandler";
|
|
52
53
|
import { BaseVideoCallHandler } from "./BaseVideoCallHandler";
|
|
53
54
|
import log from 'loglevel';
|
|
54
55
|
import { LogLevel } from "../model/MeetingStartRequest";
|
|
@@ -59,6 +60,9 @@ 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.sendWebrtcMessage = function (data) {
|
|
64
|
+
_this.communicationHandler.sendWebSocketMessage(WebrtcMessageType.SendOffer, data);
|
|
65
|
+
};
|
|
62
66
|
_this.isOfferInitParticipant = function (participant) {
|
|
63
67
|
var selfParticpant = _this.communicationHandler.getSelfParticipant();
|
|
64
68
|
if (participant.userId > selfParticpant.userId) {
|
|
@@ -94,19 +98,21 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
94
98
|
};
|
|
95
99
|
WebrtcHandler.prototype.onUserJoined = function (participant) {
|
|
96
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
-
var selfParticpant, isOfferInitParticipant, peerConnectionObject, peerConnection, offer;
|
|
101
|
+
var selfParticpant, isOfferInitParticipant, peerConnectionObject, peerConnection, offer, messageJson;
|
|
98
102
|
return __generator(this, function (_a) {
|
|
99
103
|
switch (_a.label) {
|
|
100
104
|
case 0:
|
|
101
105
|
selfParticpant = this.communicationHandler.getSelfParticipant();
|
|
102
|
-
|
|
106
|
+
console.log(selfParticpant);
|
|
107
|
+
debugger;
|
|
108
|
+
if (!(selfParticpant.userId !== participant.userId && !selfParticpant.getPeerConnections().has(participant.userId))) return [3 /*break*/, 2];
|
|
103
109
|
console.log("onUserJoined ", participant);
|
|
104
110
|
isOfferInitParticipant = this.isOfferInitParticipant(participant);
|
|
105
111
|
if (!!isOfferInitParticipant) return [3 /*break*/, 2];
|
|
106
|
-
if (!selfParticpant.
|
|
107
|
-
selfParticpant.
|
|
112
|
+
if (!selfParticpant.getPeerConnections().has(participant.userId)) {
|
|
113
|
+
selfParticpant.getPeerConnections().set(participant.userId, new PeerConnection());
|
|
108
114
|
}
|
|
109
|
-
peerConnectionObject = selfParticpant.
|
|
115
|
+
peerConnectionObject = selfParticpant.getPeerConnections().get(participant.userId);
|
|
110
116
|
peerConnection = this.dynamicLibHelper.getRTCPeerConnection(this.meetingStartRequest);
|
|
111
117
|
if (!peerConnection) return [3 /*break*/, 2];
|
|
112
118
|
peerConnection.addTransceiver("audio", { direction: "sendrecv" });
|
|
@@ -118,6 +124,8 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
118
124
|
peerConnectionObject.offer = offer;
|
|
119
125
|
// send offer to peer
|
|
120
126
|
console.log("offer", offer);
|
|
127
|
+
messageJson = { to: participant.userId, type: WebrtcMessageType.SendOffer, message: { offer: offer } };
|
|
128
|
+
this.sendWebrtcMessage(messageJson);
|
|
121
129
|
_a.label = 2;
|
|
122
130
|
case 2: return [2 /*return*/];
|
|
123
131
|
}
|
|
@@ -278,7 +278,6 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
278
278
|
if (!url_1.includes("connection=")) {
|
|
279
279
|
url_1 = url_1 + "/?connection=";
|
|
280
280
|
}
|
|
281
|
-
debugger;
|
|
282
281
|
if (url_1) {
|
|
283
282
|
this.meetingStartRequest && this.meetingStartRequest.logLevel === LogLevel.Debug && log.info("Connecting to ", url_1);
|
|
284
283
|
this.isWebSocketConnectionInProgress = true;
|
|
@@ -322,7 +321,6 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
322
321
|
}
|
|
323
322
|
};
|
|
324
323
|
this.wss.onclose = function (event) {
|
|
325
|
-
debugger;
|
|
326
324
|
_this.isSetUpDone = false;
|
|
327
325
|
_this.isWebSocketConnectionInProgress = false;
|
|
328
326
|
_this.meetingStartRequest && _this.meetingStartRequest.logLevel === LogLevel.Debug && ("WebSocket is closed now.");
|