vani-meeting-client 0.0.1 → 0.0.2
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 +3 -0
- package/lib/MeetingHandler.js +38 -0
- package/lib/inter-communication-handler/CommunicationHandler.js +7 -3
- package/lib/video-call-handler/BaseVideoCallHandler.d.ts +4 -2
- package/lib/video-call-handler/BaseVideoCallHandler.js +43 -0
- package/lib/video-call-handler/SFUHandler.d.ts +4 -2
- package/lib/video-call-handler/SFUHandler.js +44 -4
- package/lib/video-call-handler/WebrtcHandler.d.ts +3 -2
- package/lib/video-call-handler/WebrtcHandler.js +9 -3
- package/lib/websocket-handler/WebsocketHandler.d.ts +4 -1
- package/lib/websocket-handler/WebsocketHandler.js +16 -8
- package/package.json +2 -2
package/lib/MeetingHandler.d.ts
CHANGED
|
@@ -24,6 +24,9 @@ export declare class MeetingHandler {
|
|
|
24
24
|
unmute(userId?: string): Promise<TaskResponse>;
|
|
25
25
|
stopTrack(track: Track): void;
|
|
26
26
|
addCustomTrack(track: Track): void;
|
|
27
|
+
pauseIncomingTrack(track: Track): void;
|
|
28
|
+
resumeIncomingTrack(track: Track): void;
|
|
29
|
+
updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
|
|
27
30
|
participantByUserId(userId: string): Participant | undefined;
|
|
28
31
|
updateParticipantData(participant: Participant): Participant | undefined;
|
|
29
32
|
getUpdatedParticipantsListFromServer(): void;
|
package/lib/MeetingHandler.js
CHANGED
|
@@ -40,6 +40,7 @@ import * as log from 'loglevel';
|
|
|
40
40
|
import { WebSocketBasicEvents, WebsocketHandler } from "./websocket-handler/WebsocketHandler";
|
|
41
41
|
import { CommunicationHandler } from "./inter-communication-handler/CommunicationHandler";
|
|
42
42
|
import { UserMediaHandler } from "./user-media-handler/UserMediaHandler";
|
|
43
|
+
import Analytics from 'analytics';
|
|
43
44
|
var MeetingHandler = /** @class */ (function () {
|
|
44
45
|
function MeetingHandler() {
|
|
45
46
|
this.communicationHandler = new CommunicationHandler(this);
|
|
@@ -233,6 +234,23 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
233
234
|
var _a;
|
|
234
235
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.addUpdateLocalTrack(track);
|
|
235
236
|
};
|
|
237
|
+
MeetingHandler.prototype.pauseIncomingTrack = function (track) {
|
|
238
|
+
var _a;
|
|
239
|
+
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.pauseIncomingTrack(track);
|
|
240
|
+
};
|
|
241
|
+
MeetingHandler.prototype.resumeIncomingTrack = function (track) {
|
|
242
|
+
var _a;
|
|
243
|
+
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.resumeIncomingTrack(track);
|
|
244
|
+
};
|
|
245
|
+
MeetingHandler.prototype.updateSpatialForTrack = function (track, spatialLayerIndex) {
|
|
246
|
+
var _a;
|
|
247
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
248
|
+
return __generator(this, function (_b) {
|
|
249
|
+
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.updateSpatialForTrack(track, spatialLayerIndex);
|
|
250
|
+
return [2 /*return*/];
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
};
|
|
236
254
|
//Participant
|
|
237
255
|
MeetingHandler.prototype.participantByUserId = function (userId) {
|
|
238
256
|
var _a, _b, _c;
|
|
@@ -392,7 +410,24 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
392
410
|
};
|
|
393
411
|
MeetingHandler.prototype.handleGA = function () {
|
|
394
412
|
return __awaiter(this, void 0, void 0, function () {
|
|
413
|
+
var analytics;
|
|
395
414
|
return __generator(this, function (_a) {
|
|
415
|
+
if (this.meetingStartRequest) {
|
|
416
|
+
analytics = Analytics({
|
|
417
|
+
app: this.meetingStartRequest.appId,
|
|
418
|
+
plugins: [
|
|
419
|
+
googleAnalytics({
|
|
420
|
+
trackingId: 'UA-190458994-3'
|
|
421
|
+
})
|
|
422
|
+
]
|
|
423
|
+
});
|
|
424
|
+
analytics.page();
|
|
425
|
+
analytics.track('playedVideo', {
|
|
426
|
+
category: 'AppId',
|
|
427
|
+
label: this.meetingStartRequest.appId,
|
|
428
|
+
value: this.meetingStartRequest.roomId
|
|
429
|
+
});
|
|
430
|
+
}
|
|
396
431
|
return [2 /*return*/];
|
|
397
432
|
});
|
|
398
433
|
});
|
|
@@ -400,3 +435,6 @@ var MeetingHandler = /** @class */ (function () {
|
|
|
400
435
|
return MeetingHandler;
|
|
401
436
|
}());
|
|
402
437
|
export { MeetingHandler };
|
|
438
|
+
function googleAnalytics(arg0) {
|
|
439
|
+
throw new Error("Function not implemented.");
|
|
440
|
+
}
|
|
@@ -95,7 +95,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
95
95
|
participant.isVideoBlockedByAdmin = this.meetingStartRequest.defaultVideoBlocked;
|
|
96
96
|
participant.isScreenshareBlockedByAdmin = this.meetingStartRequest.defaultScreenShareBlocked;
|
|
97
97
|
participant.isRecordingUser = this.meetingStartRequest.isRecordingUser;
|
|
98
|
-
this.
|
|
98
|
+
this.addParticipantIfNotExist(participant);
|
|
99
99
|
}
|
|
100
100
|
return participant;
|
|
101
101
|
}
|
|
@@ -129,6 +129,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
129
129
|
return this.allParticipants.find(function (participant) { return participant.userId === userId; });
|
|
130
130
|
};
|
|
131
131
|
CommunicationHandler.prototype.addParticipantIfNotExist = function (participant, shouldInfrom) {
|
|
132
|
+
var _a;
|
|
132
133
|
if (shouldInfrom === void 0) { shouldInfrom = false; }
|
|
133
134
|
var oldParticipant = this.participantByUserId(participant.userId);
|
|
134
135
|
if (oldParticipant) {
|
|
@@ -144,11 +145,13 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
144
145
|
if (shouldInfrom) {
|
|
145
146
|
this.emitMessageToSource(VaniEvent.OnUserJoined, participant);
|
|
146
147
|
}
|
|
148
|
+
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.onParticipantUpdated();
|
|
147
149
|
return participant;
|
|
148
150
|
}
|
|
149
151
|
};
|
|
150
152
|
CommunicationHandler.prototype.removeParticipant = function (participant, shouldInfrom) {
|
|
151
153
|
var _this = this;
|
|
154
|
+
var _a;
|
|
152
155
|
if (shouldInfrom === void 0) { shouldInfrom = false; }
|
|
153
156
|
var tracks = this.getAllTracksForParticipant(participant);
|
|
154
157
|
if (tracks) {
|
|
@@ -157,6 +160,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
157
160
|
});
|
|
158
161
|
}
|
|
159
162
|
Utility.deleteArrayObject(participant, this.allParticipants);
|
|
163
|
+
(_a = this.videoCallHandler) === null || _a === void 0 ? void 0 : _a.onParticipantUpdated();
|
|
160
164
|
if (shouldInfrom) {
|
|
161
165
|
this.emitMessageToSource(VaniEvent.OnUserLeft, participant);
|
|
162
166
|
}
|
|
@@ -305,7 +309,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
305
309
|
if (this.internetReachbilityTimeout) {
|
|
306
310
|
return;
|
|
307
311
|
}
|
|
308
|
-
this.internetReachbilityTimeout = setTimeout(this.checkIfInternetReachable, 200, 0);
|
|
312
|
+
this.internetReachbilityTimeout = window.setTimeout(this.checkIfInternetReachable, 200, 0);
|
|
309
313
|
};
|
|
310
314
|
CommunicationHandler.prototype.checkIfInternetReachable = function (count) {
|
|
311
315
|
var _this = this;
|
|
@@ -335,7 +339,7 @@ var CommunicationHandler = /** @class */ (function () {
|
|
|
335
339
|
(_a = _this.meetingHandler) === null || _a === void 0 ? void 0 : _a.endAndDestory();
|
|
336
340
|
return;
|
|
337
341
|
}
|
|
338
|
-
_this.internetReachbilityTimeout = setTimeout(_this.checkIfInternetReachable, 1000, count);
|
|
342
|
+
_this.internetReachbilityTimeout = window.setTimeout(_this.checkIfInternetReachable, 1000, count);
|
|
339
343
|
});
|
|
340
344
|
;
|
|
341
345
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Base } from "../base/Base";
|
|
2
2
|
import { Track } from "../model/Track";
|
|
3
3
|
import { WebSocketMessageBody } from "../websocket-handler/WebsocketHandler";
|
|
4
|
-
import { Participant } from "../model/Participant";
|
|
5
4
|
export declare abstract class BaseVideoCallHandler extends Base {
|
|
6
5
|
protected onObjectCreated(): void;
|
|
7
6
|
abstract init(): Promise<void>;
|
|
@@ -11,7 +10,10 @@ export declare abstract class BaseVideoCallHandler extends Base {
|
|
|
11
10
|
abstract pauseTrack(track: Track): void;
|
|
12
11
|
abstract resumeTrack(track: Track): void;
|
|
13
12
|
abstract sendTrack(track: Track): void;
|
|
14
|
-
abstract
|
|
13
|
+
abstract resumeIncomingTrack(track: Track): void;
|
|
14
|
+
abstract pauseIncomingTrack(track: Track): void;
|
|
15
|
+
abstract onParticipantUpdated(): void;
|
|
16
|
+
updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
|
|
15
17
|
reconnectedWithoutPing(): void;
|
|
16
18
|
cleanup(): void;
|
|
17
19
|
}
|
|
@@ -13,6 +13,42 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (_) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
16
52
|
import { Base } from "../base/Base";
|
|
17
53
|
import log from 'loglevel';
|
|
18
54
|
var BaseVideoCallHandler = /** @class */ (function (_super) {
|
|
@@ -25,6 +61,13 @@ var BaseVideoCallHandler = /** @class */ (function (_super) {
|
|
|
25
61
|
_super.prototype.onObjectCreated.call(this);
|
|
26
62
|
(_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.setVideoCallHandler(this);
|
|
27
63
|
};
|
|
64
|
+
BaseVideoCallHandler.prototype.updateSpatialForTrack = function (track, spatialLayerIndex) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
return [2 /*return*/];
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
28
71
|
BaseVideoCallHandler.prototype.reconnectedWithoutPing = function () {
|
|
29
72
|
};
|
|
30
73
|
BaseVideoCallHandler.prototype.cleanup = function () {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseVideoCallHandler } from "./BaseVideoCallHandler";
|
|
2
2
|
import { WebSocketMessageBody } from "../websocket-handler/WebsocketHandler";
|
|
3
3
|
import { Track } from "../model/Track";
|
|
4
|
-
import { Participant } from "../model/Participant";
|
|
5
4
|
export declare class SFUHandler extends BaseVideoCallHandler {
|
|
6
5
|
private device;
|
|
7
6
|
private transportCallBacks;
|
|
@@ -15,7 +14,11 @@ export declare class SFUHandler extends BaseVideoCallHandler {
|
|
|
15
14
|
stopTrack(track: Track): void;
|
|
16
15
|
pauseTrack(track: Track): void;
|
|
17
16
|
resumeTrack(track: Track): void;
|
|
17
|
+
pauseIncomingTrack(track: Track): void;
|
|
18
|
+
resumeIncomingTrack(track: Track): void;
|
|
19
|
+
updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
|
|
18
20
|
sendTrack(track: Track): Promise<void>;
|
|
21
|
+
onParticipantUpdated(): void;
|
|
19
22
|
init(): Promise<void>;
|
|
20
23
|
private addObserverForDevice;
|
|
21
24
|
private onRouterRtpCapabilities;
|
|
@@ -32,5 +35,4 @@ export declare class SFUHandler extends BaseVideoCallHandler {
|
|
|
32
35
|
private onServerConsumer;
|
|
33
36
|
private onSpeakerChanged;
|
|
34
37
|
cleanup(): void;
|
|
35
|
-
onParticipantLeft(participant: Participant): void;
|
|
36
38
|
}
|
|
@@ -130,6 +130,36 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
130
130
|
this.sendSFUMessageToSocket(messageJson);
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
+
SFUHandler.prototype.pauseIncomingTrack = function (track) {
|
|
134
|
+
var consumer = this.consumers.find(function (consumer) { return consumer.appData.producerData.trackId === track.trackId; });
|
|
135
|
+
if (consumer) {
|
|
136
|
+
var messageJson = { to: "self", type: SFUMessageType.PauseConsumer, message: { id: consumer.id } };
|
|
137
|
+
this.sendSFUMessageToSocket(messageJson);
|
|
138
|
+
consumer.pause();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
SFUHandler.prototype.resumeIncomingTrack = function (track) {
|
|
142
|
+
var consumer = this.consumers.find(function (consumer) { return consumer.appData.producerData.trackId === track.trackId; });
|
|
143
|
+
if (consumer) {
|
|
144
|
+
var messageJson = { to: "self", type: SFUMessageType.ResumeConsumer, message: { id: consumer.id } };
|
|
145
|
+
this.sendSFUMessageToSocket(messageJson);
|
|
146
|
+
consumer.resume();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
SFUHandler.prototype.updateSpatialForTrack = function (track, spatialLayerIndex) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
+
var consumer, messageJson;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
log.info("updateSpatialForTrack");
|
|
154
|
+
consumer = this.consumers.find(function (consumer) { return consumer.appData.producerData.trackId === track.trackId; });
|
|
155
|
+
if (consumer) {
|
|
156
|
+
messageJson = { to: "self", type: SFUMessageType.UpdateSpatialConsumer, message: { id: consumer.id, spatialLayer: spatialLayerIndex } };
|
|
157
|
+
this.sendSFUMessageToSocket(messageJson);
|
|
158
|
+
}
|
|
159
|
+
return [2 /*return*/];
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
|
133
163
|
SFUHandler.prototype.sendTrack = function (track) {
|
|
134
164
|
var _a, _b;
|
|
135
165
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -155,7 +185,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
155
185
|
webcamProducer = _c.sent();
|
|
156
186
|
if (webcamProducer) {
|
|
157
187
|
this.producers.push(webcamProducer);
|
|
158
|
-
|
|
188
|
+
this.onParticipantUpdated();
|
|
159
189
|
// this.sendMessageReadyToConsume();
|
|
160
190
|
}
|
|
161
191
|
_c.label = 3;
|
|
@@ -164,6 +194,18 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
164
194
|
});
|
|
165
195
|
});
|
|
166
196
|
};
|
|
197
|
+
SFUHandler.prototype.onParticipantUpdated = function () {
|
|
198
|
+
if (!this.communicationHandler || this.communicationHandler.getAllParticipants().length < 2) {
|
|
199
|
+
this.producers.forEach(function (producer) {
|
|
200
|
+
producer.pause();
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
this.producers.forEach(function (producer) {
|
|
205
|
+
producer.resume();
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
};
|
|
167
209
|
SFUHandler.prototype.init = function () {
|
|
168
210
|
return __awaiter(this, void 0, void 0, function () {
|
|
169
211
|
var messageJson;
|
|
@@ -360,6 +402,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
360
402
|
consumerObj = data.message.consumer;
|
|
361
403
|
this.consumerTransport.consume(consumerObj).then(function (consumer) {
|
|
362
404
|
var _a, _b;
|
|
405
|
+
_this.consumers.push(consumer);
|
|
363
406
|
var mediaTrack = consumer.track;
|
|
364
407
|
var data = consumer.appData.producerData;
|
|
365
408
|
log.info(data);
|
|
@@ -370,7 +413,6 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
370
413
|
}
|
|
371
414
|
var messageJson = { to: "self", type: SFUMessageType.ResumeConsumer, message: { id: consumer.id } };
|
|
372
415
|
_this.sendSFUMessageToSocket(messageJson);
|
|
373
|
-
_this.consumers.push(consumer);
|
|
374
416
|
});
|
|
375
417
|
}
|
|
376
418
|
return [2 /*return*/];
|
|
@@ -407,8 +449,6 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
407
449
|
}
|
|
408
450
|
});
|
|
409
451
|
};
|
|
410
|
-
SFUHandler.prototype.onParticipantLeft = function (participant) {
|
|
411
|
-
};
|
|
412
452
|
return SFUHandler;
|
|
413
453
|
}(BaseVideoCallHandler));
|
|
414
454
|
export { SFUHandler };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Participant } from "../model/Participant";
|
|
2
1
|
import { Track } from "../model/Track";
|
|
3
2
|
import { WebSocketMessageBody } from "../websocket-handler/WebsocketHandler";
|
|
4
3
|
import { BaseVideoCallHandler } from "./BaseVideoCallHandler";
|
|
5
4
|
export declare class WebrtcHandler extends BaseVideoCallHandler {
|
|
5
|
+
onParticipantUpdated(): void;
|
|
6
|
+
resumeIncomingTrack(track: Track): void;
|
|
7
|
+
pauseIncomingTrack(track: Track): void;
|
|
6
8
|
onSocketMessage(websocketCallHandler: WebSocketMessageBody): void;
|
|
7
9
|
init(): Promise<void>;
|
|
8
10
|
onReconnect(): Promise<void>;
|
|
@@ -10,5 +12,4 @@ export declare class WebrtcHandler extends BaseVideoCallHandler {
|
|
|
10
12
|
pauseTrack(track: Track): void;
|
|
11
13
|
resumeTrack(track: Track): void;
|
|
12
14
|
sendTrack(track: Track): void;
|
|
13
|
-
onParticipantLeft(participant: Participant): void;
|
|
14
15
|
}
|
|
@@ -56,6 +56,15 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
56
56
|
function WebrtcHandler() {
|
|
57
57
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
58
58
|
}
|
|
59
|
+
WebrtcHandler.prototype.onParticipantUpdated = function () {
|
|
60
|
+
throw new Error("Method not implemented.");
|
|
61
|
+
};
|
|
62
|
+
WebrtcHandler.prototype.resumeIncomingTrack = function (track) {
|
|
63
|
+
throw new Error("Method not implemented.");
|
|
64
|
+
};
|
|
65
|
+
WebrtcHandler.prototype.pauseIncomingTrack = function (track) {
|
|
66
|
+
throw new Error("Method not implemented.");
|
|
67
|
+
};
|
|
59
68
|
WebrtcHandler.prototype.onSocketMessage = function (websocketCallHandler) {
|
|
60
69
|
throw new Error("Method not implemented.");
|
|
61
70
|
};
|
|
@@ -82,9 +91,6 @@ var WebrtcHandler = /** @class */ (function (_super) {
|
|
|
82
91
|
WebrtcHandler.prototype.sendTrack = function (track) {
|
|
83
92
|
throw new Error("Method not implemented.");
|
|
84
93
|
};
|
|
85
|
-
WebrtcHandler.prototype.onParticipantLeft = function (participant) {
|
|
86
|
-
throw new Error("Method not implemented.");
|
|
87
|
-
};
|
|
88
94
|
return WebrtcHandler;
|
|
89
95
|
}(BaseVideoCallHandler));
|
|
90
96
|
export { WebrtcHandler };
|
|
@@ -44,10 +44,12 @@ export declare enum SFUMessageType {
|
|
|
44
44
|
ConsumeProductId = "consumeProductId",
|
|
45
45
|
OnServerConsumer = "onServerConsumer",
|
|
46
46
|
ResumeConsumer = "resumeConsumer",
|
|
47
|
+
PauseConsumer = "pauseConsumer",
|
|
47
48
|
OnProduceSyncDone = "produceSyncDone",
|
|
48
49
|
OnSpeakerChanged = "onSpeakerChanged",
|
|
49
50
|
OnRestartIceCandidate = "restartIceCandidate",
|
|
50
|
-
OnTrackEnded = "onTrackEnded"
|
|
51
|
+
OnTrackEnded = "onTrackEnded",
|
|
52
|
+
UpdateSpatialConsumer = "updateSpatialConsumer"
|
|
51
53
|
}
|
|
52
54
|
export declare type WebSocketEvents = SFUMessageType | WebSocketBasicEvents;
|
|
53
55
|
export interface WebSocketMessageBody {
|
|
@@ -70,6 +72,7 @@ export declare class WebsocketHandler extends Base {
|
|
|
70
72
|
isWebScoketConnected(): boolean;
|
|
71
73
|
sendSocketMessage(type: WebSocketEvents, data: any): void;
|
|
72
74
|
reconnectOnInternetFailur(): void;
|
|
75
|
+
private onWebSocketClosed;
|
|
73
76
|
private tryToReconectSocket;
|
|
74
77
|
private onSocketConnected;
|
|
75
78
|
private socketSubscribeToTopic;
|
|
@@ -100,10 +100,12 @@ export var SFUMessageType;
|
|
|
100
100
|
SFUMessageType["ConsumeProductId"] = "consumeProductId";
|
|
101
101
|
SFUMessageType["OnServerConsumer"] = "onServerConsumer";
|
|
102
102
|
SFUMessageType["ResumeConsumer"] = "resumeConsumer";
|
|
103
|
+
SFUMessageType["PauseConsumer"] = "pauseConsumer";
|
|
103
104
|
SFUMessageType["OnProduceSyncDone"] = "produceSyncDone";
|
|
104
105
|
SFUMessageType["OnSpeakerChanged"] = "onSpeakerChanged";
|
|
105
106
|
SFUMessageType["OnRestartIceCandidate"] = "restartIceCandidate";
|
|
106
107
|
SFUMessageType["OnTrackEnded"] = "onTrackEnded";
|
|
108
|
+
SFUMessageType["UpdateSpatialConsumer"] = "updateSpatialConsumer";
|
|
107
109
|
})(SFUMessageType || (SFUMessageType = {}));
|
|
108
110
|
var ConnectionType;
|
|
109
111
|
(function (ConnectionType) {
|
|
@@ -134,7 +136,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
134
136
|
this.wss = undefined;
|
|
135
137
|
}
|
|
136
138
|
if (this.socketCheckTimeout) {
|
|
137
|
-
clearTimeout(this.socketCheckTimeout);
|
|
139
|
+
window.clearTimeout(this.socketCheckTimeout);
|
|
138
140
|
this.socketCheckTimeout = undefined;
|
|
139
141
|
}
|
|
140
142
|
};
|
|
@@ -231,11 +233,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
231
233
|
_this.isWebSocketConnectionInProgress = false;
|
|
232
234
|
log.info("WebSocket is closed now.");
|
|
233
235
|
log.warn(event);
|
|
234
|
-
|
|
235
|
-
_this.socketCheckTimeout = setTimeout(function () {
|
|
236
|
-
_this.tryToReconectSocket;
|
|
237
|
-
}, 1000);
|
|
238
|
-
}
|
|
236
|
+
_this.onWebSocketClosed(event);
|
|
239
237
|
};
|
|
240
238
|
}
|
|
241
239
|
}
|
|
@@ -269,8 +267,18 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
269
267
|
this.connect(true);
|
|
270
268
|
}
|
|
271
269
|
};
|
|
270
|
+
WebsocketHandler.prototype.onWebSocketClosed = function (event) {
|
|
271
|
+
var _this = this;
|
|
272
|
+
log.info("onWebSocketClosed");
|
|
273
|
+
if (event.wasClean === false) {
|
|
274
|
+
this.socketCheckTimeout = window.setTimeout(function () {
|
|
275
|
+
_this.tryToReconectSocket();
|
|
276
|
+
}, 1000);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
272
279
|
WebsocketHandler.prototype.tryToReconectSocket = function () {
|
|
273
280
|
var _a;
|
|
281
|
+
log.info("tryToReconectSocket");
|
|
274
282
|
if (this.isWebScoketConnected() === false && this.isEnded === false) {
|
|
275
283
|
this.wss = undefined;
|
|
276
284
|
this.connection = ConnectionType.reconnect;
|
|
@@ -312,7 +320,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
312
320
|
var checkIfSetupDone = { to: this.meetingStartRequest.userId };
|
|
313
321
|
this.sendSocketMessage(WebSocketBasicEvents.IsSetupDone, checkIfSetupDone);
|
|
314
322
|
log.info("Vani setupDone asked");
|
|
315
|
-
setTimeout(function () {
|
|
323
|
+
window.setTimeout(function () {
|
|
316
324
|
if (_this.isSetUpDone || _this.setUpTry > 10) {
|
|
317
325
|
return;
|
|
318
326
|
}
|
|
@@ -358,7 +366,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
358
366
|
else if (type === WebSocketBasicEvents.OnMeetingStartTime) {
|
|
359
367
|
if (data && data.time) {
|
|
360
368
|
var time = data.time;
|
|
361
|
-
if (time
|
|
369
|
+
if (time > new Date().getTime()) {
|
|
362
370
|
time = new Date().getTime();
|
|
363
371
|
}
|
|
364
372
|
(_g = this.communicationHandler) === null || _g === void 0 ? void 0 : _g.emitMessageToSource(VaniEvent.OnMeetingStartTime, (time + ""));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vani-meeting-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Vani Meeting Clinet SDK",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"typescript": "^4.5.2"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"
|
|
45
|
+
"analytics": "^0.7.21",
|
|
46
46
|
"axios": "^0.24.0",
|
|
47
47
|
"loglevel": "^1.8.0",
|
|
48
48
|
"mediasoup-client": "^3.6.47"
|