vani-meeting-client 1.3.8 → 1.4.0
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.
|
@@ -25,7 +25,7 @@ export declare class UserMediaHandler extends Base {
|
|
|
25
25
|
private onScreenShareStreamGot;
|
|
26
26
|
private onTrack;
|
|
27
27
|
getDevice(type: GetDevicesType): Promise<Device[]>;
|
|
28
|
-
registerForDeviceChange()
|
|
28
|
+
registerForDeviceChange: () => Promise<void>;
|
|
29
29
|
stopScreenSharing(): Promise<void>;
|
|
30
30
|
pauseCamera(userId?: string): Promise<TaskResponse>;
|
|
31
31
|
muteUser(userId?: string): Promise<TaskResponse>;
|
|
@@ -67,6 +67,69 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
67
67
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
68
68
|
_this.isVideoAudioFetchInProgress = false;
|
|
69
69
|
_this.isScreenShareFetchInProgress = false;
|
|
70
|
+
_this.registerForDeviceChange = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
71
|
+
var mediaDevice;
|
|
72
|
+
var _this = this;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
mediaDevice = new DynamicLibHelper().getMediaDevicesVariable(this.meetingStartRequest);
|
|
75
|
+
if (mediaDevice) {
|
|
76
|
+
mediaDevice.ondevicechange = (function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
77
|
+
var oldTrack, isAudioInDeviceFound, canFetchAudioIn, audioInDevices, audioDevice, oldVideoTrack, isCameraDeviceFound, canFetchVideoIn, cameraDevices, cameraDevice;
|
|
78
|
+
var _this = this;
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
return __generator(this, function (_d) {
|
|
81
|
+
switch (_d.label) {
|
|
82
|
+
case 0:
|
|
83
|
+
oldTrack = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfTrackByType(TrackKind.Audio);
|
|
84
|
+
isAudioInDeviceFound = false;
|
|
85
|
+
canFetchAudioIn = false;
|
|
86
|
+
if (!oldTrack) return [3 /*break*/, 2];
|
|
87
|
+
return [4 /*yield*/, this.getDevice(GetDevicesType.AudioIn)];
|
|
88
|
+
case 1:
|
|
89
|
+
audioInDevices = _d.sent();
|
|
90
|
+
if (this.meetingStartRequest && this.meetingStartRequest.audioInDevice) {
|
|
91
|
+
audioDevice = audioInDevices.find(function (device) { return device.id === _this.meetingStartRequest.audioInDevice; });
|
|
92
|
+
if (audioDevice) {
|
|
93
|
+
isAudioInDeviceFound = true;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
this.meetingStartRequest.audioInDevice = undefined;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
canFetchAudioIn = true;
|
|
100
|
+
_d.label = 2;
|
|
101
|
+
case 2:
|
|
102
|
+
oldVideoTrack = (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.getSelfTrackByType(TrackKind.Video);
|
|
103
|
+
isCameraDeviceFound = false;
|
|
104
|
+
canFetchVideoIn = false;
|
|
105
|
+
if (!oldVideoTrack) return [3 /*break*/, 4];
|
|
106
|
+
canFetchVideoIn = true;
|
|
107
|
+
return [4 /*yield*/, this.getDevice(GetDevicesType.VideoIn)];
|
|
108
|
+
case 3:
|
|
109
|
+
cameraDevices = _d.sent();
|
|
110
|
+
if (this.meetingStartRequest && this.meetingStartRequest.cameraDevice) {
|
|
111
|
+
cameraDevice = cameraDevices.find(function (device) { return device.id === _this.meetingStartRequest.cameraDevice; });
|
|
112
|
+
if (cameraDevice) {
|
|
113
|
+
isCameraDeviceFound = true;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this.meetingStartRequest.cameraDevice = undefined;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
_d.label = 4;
|
|
120
|
+
case 4:
|
|
121
|
+
if ((!isAudioInDeviceFound && canFetchAudioIn) || (!isCameraDeviceFound && canFetchVideoIn)) {
|
|
122
|
+
this.startLocalStream(!isCameraDeviceFound && canFetchVideoIn, !isAudioInDeviceFound && canFetchAudioIn, true);
|
|
123
|
+
}
|
|
124
|
+
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.emitMessageToSource(VaniEvent.OnDevicesChanged, {});
|
|
125
|
+
return [2 /*return*/];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}); });
|
|
129
|
+
}
|
|
130
|
+
return [2 /*return*/];
|
|
131
|
+
});
|
|
132
|
+
}); };
|
|
70
133
|
return _this;
|
|
71
134
|
}
|
|
72
135
|
UserMediaHandler.prototype.switchCamera = function () {
|
|
@@ -369,65 +432,6 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
369
432
|
});
|
|
370
433
|
});
|
|
371
434
|
};
|
|
372
|
-
UserMediaHandler.prototype.registerForDeviceChange = function () {
|
|
373
|
-
var _this = this;
|
|
374
|
-
var mediaDevice = new DynamicLibHelper().getMediaDevicesVariable(this.meetingStartRequest);
|
|
375
|
-
if (mediaDevice) {
|
|
376
|
-
mediaDevice.ondevicechange = (function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
377
|
-
var oldTrack, isAudioInDeviceFound, canFetchAudioIn, audioInDevices, audioDevice, oldVideoTrack, isCameraDeviceFound, canFetchVideoIn, cameraDevices, cameraDevice;
|
|
378
|
-
var _this = this;
|
|
379
|
-
var _a, _b, _c;
|
|
380
|
-
return __generator(this, function (_d) {
|
|
381
|
-
switch (_d.label) {
|
|
382
|
-
case 0:
|
|
383
|
-
oldTrack = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfTrackByType(TrackKind.Audio);
|
|
384
|
-
isAudioInDeviceFound = false;
|
|
385
|
-
canFetchAudioIn = false;
|
|
386
|
-
if (!oldTrack) return [3 /*break*/, 2];
|
|
387
|
-
return [4 /*yield*/, this.getDevice(GetDevicesType.AudioIn)];
|
|
388
|
-
case 1:
|
|
389
|
-
audioInDevices = _d.sent();
|
|
390
|
-
if (this.meetingStartRequest && this.meetingStartRequest.audioInDevice) {
|
|
391
|
-
audioDevice = audioInDevices.find(function (device) { return device.id === _this.meetingStartRequest.audioInDevice; });
|
|
392
|
-
if (audioDevice) {
|
|
393
|
-
isAudioInDeviceFound = true;
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
this.meetingStartRequest.audioInDevice = undefined;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
canFetchAudioIn = true;
|
|
400
|
-
_d.label = 2;
|
|
401
|
-
case 2:
|
|
402
|
-
oldVideoTrack = (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.getSelfTrackByType(TrackKind.Video);
|
|
403
|
-
isCameraDeviceFound = false;
|
|
404
|
-
canFetchVideoIn = false;
|
|
405
|
-
if (!oldVideoTrack) return [3 /*break*/, 4];
|
|
406
|
-
canFetchVideoIn = true;
|
|
407
|
-
return [4 /*yield*/, this.getDevice(GetDevicesType.VideoIn)];
|
|
408
|
-
case 3:
|
|
409
|
-
cameraDevices = _d.sent();
|
|
410
|
-
if (this.meetingStartRequest && this.meetingStartRequest.cameraDevice) {
|
|
411
|
-
cameraDevice = cameraDevices.find(function (device) { return device.id === _this.meetingStartRequest.cameraDevice; });
|
|
412
|
-
if (cameraDevice) {
|
|
413
|
-
isCameraDeviceFound = true;
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
this.meetingStartRequest.cameraDevice = undefined;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
_d.label = 4;
|
|
420
|
-
case 4:
|
|
421
|
-
if ((!isAudioInDeviceFound && canFetchAudioIn) || (!isCameraDeviceFound && canFetchVideoIn)) {
|
|
422
|
-
this.startLocalStream(!isCameraDeviceFound && canFetchVideoIn, !isAudioInDeviceFound && canFetchAudioIn, true);
|
|
423
|
-
}
|
|
424
|
-
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.emitMessageToSource(VaniEvent.OnDevicesChanged, {});
|
|
425
|
-
return [2 /*return*/];
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
}); });
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
435
|
UserMediaHandler.prototype.stopScreenSharing = function () {
|
|
432
436
|
var _a, _b, _c, _d;
|
|
433
437
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -178,6 +178,9 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
178
178
|
var producer, consumer;
|
|
179
179
|
return __generator(this, function (_a) {
|
|
180
180
|
console.log("resumeProducerOrConsumerForTrack");
|
|
181
|
+
if (track.track) {
|
|
182
|
+
track.track.enabled = true;
|
|
183
|
+
}
|
|
181
184
|
producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
|
|
182
185
|
if (producer) {
|
|
183
186
|
producer.resume();
|
|
@@ -196,7 +199,7 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
196
199
|
return __awaiter(this, void 0, void 0, function () {
|
|
197
200
|
var producer, consumer;
|
|
198
201
|
return __generator(this, function (_a) {
|
|
199
|
-
console.log("
|
|
202
|
+
console.log("pauseProducerOrConsumerForTrack");
|
|
200
203
|
producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
|
|
201
204
|
if (producer) {
|
|
202
205
|
producer.pause();
|
|
@@ -207,6 +210,9 @@ var SFUHandler = /** @class */ (function (_super) {
|
|
|
207
210
|
consumer.pause();
|
|
208
211
|
}
|
|
209
212
|
}
|
|
213
|
+
if (track.track) {
|
|
214
|
+
track.track.enabled = false;
|
|
215
|
+
}
|
|
210
216
|
return [2 /*return*/];
|
|
211
217
|
});
|
|
212
218
|
});
|