vani-meeting-client 0.0.7 → 0.1.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.
|
@@ -12,6 +12,7 @@ export declare class UserMediaHandler extends Base {
|
|
|
12
12
|
private cameraFacingMode?;
|
|
13
13
|
private videoPauseResumePromiseResolver?;
|
|
14
14
|
private muteUmutePromiseResolver?;
|
|
15
|
+
private userMediaPayload?;
|
|
15
16
|
switchCamera(): Promise<void>;
|
|
16
17
|
startScreenShare(isAudioRequired?: boolean, shouldAddTrackImmediately?: boolean, screensharePayload?: any): Promise<void>;
|
|
17
18
|
startLocalStream(isVideoRequired: boolean, isAudioRequired: boolean, shouldAddTrackImmediately: boolean, userMediaPayload?: any): Promise<void>;
|
|
@@ -129,6 +129,10 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
129
129
|
return __generator(this, function (_a) {
|
|
130
130
|
switch (_a.label) {
|
|
131
131
|
case 0:
|
|
132
|
+
if (!userMediaPayload && this.userMediaPayload) {
|
|
133
|
+
userMediaPayload = this.userMediaPayload;
|
|
134
|
+
}
|
|
135
|
+
this.userMediaPayload = userMediaPayload;
|
|
132
136
|
if (this.isVideoAudioFetchInProgress) {
|
|
133
137
|
log.warn("Already fetching stream. So request ignored");
|
|
134
138
|
return [2 /*return*/];
|
|
@@ -219,7 +223,7 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
219
223
|
userMediaPayload.audio = this.getAudioDictionay();
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
|
-
|
|
226
|
+
log.info(userMediaPayload);
|
|
223
227
|
(new DynamicLibHelper()).getMediaDevicesVariable(this.meetingStartRequest).getUserMedia(userMediaPayload)
|
|
224
228
|
.then(function (stream) {
|
|
225
229
|
_this.onStreamGot(stream, isAudioRequired, isVideoRequired, shouldAddTrackImmediately);
|
|
@@ -353,15 +357,19 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
353
357
|
var mediaDevice = new DynamicLibHelper().getMediaDevicesVariable(this.meetingStartRequest);
|
|
354
358
|
if (mediaDevice) {
|
|
355
359
|
mediaDevice.ondevicechange = (function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
356
|
-
var
|
|
360
|
+
var oldTrack, isAudioInDeviceFound, canFetchAudioIn, audioInDevices, audioDevice, oldVideoTrack, isCameraDeviceFound, canFetchVideoIn, cameraDevices, cameraDevice;
|
|
357
361
|
var _this = this;
|
|
358
|
-
var _a;
|
|
359
|
-
return __generator(this, function (
|
|
360
|
-
switch (
|
|
361
|
-
case 0:
|
|
362
|
-
|
|
363
|
-
audioInDevices = _b.sent();
|
|
362
|
+
var _a, _b, _c;
|
|
363
|
+
return __generator(this, function (_d) {
|
|
364
|
+
switch (_d.label) {
|
|
365
|
+
case 0:
|
|
366
|
+
oldTrack = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfTrackByType(TrackKind.Audio);
|
|
364
367
|
isAudioInDeviceFound = false;
|
|
368
|
+
canFetchAudioIn = false;
|
|
369
|
+
if (!oldTrack) return [3 /*break*/, 2];
|
|
370
|
+
return [4 /*yield*/, this.getDevice(GetDevicesType.AudioIn)];
|
|
371
|
+
case 1:
|
|
372
|
+
audioInDevices = _d.sent();
|
|
365
373
|
if (this.meetingStartRequest && this.meetingStartRequest.audioInDevice) {
|
|
366
374
|
audioDevice = audioInDevices.find(function (device) { return device.id === _this.meetingStartRequest.audioInDevice; });
|
|
367
375
|
if (audioDevice) {
|
|
@@ -371,10 +379,17 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
371
379
|
this.meetingStartRequest.audioInDevice = undefined;
|
|
372
380
|
}
|
|
373
381
|
}
|
|
374
|
-
|
|
382
|
+
canFetchAudioIn = true;
|
|
383
|
+
_d.label = 2;
|
|
375
384
|
case 2:
|
|
376
|
-
|
|
385
|
+
oldVideoTrack = (_b = this.communicationHandler) === null || _b === void 0 ? void 0 : _b.getSelfTrackByType(TrackKind.Video);
|
|
377
386
|
isCameraDeviceFound = false;
|
|
387
|
+
canFetchVideoIn = false;
|
|
388
|
+
if (!oldVideoTrack) return [3 /*break*/, 4];
|
|
389
|
+
canFetchVideoIn = true;
|
|
390
|
+
return [4 /*yield*/, this.getDevice(GetDevicesType.VideoIn)];
|
|
391
|
+
case 3:
|
|
392
|
+
cameraDevices = _d.sent();
|
|
378
393
|
if (this.meetingStartRequest && this.meetingStartRequest.cameraDevice) {
|
|
379
394
|
cameraDevice = cameraDevices.find(function (device) { return device.id === _this.meetingStartRequest.cameraDevice; });
|
|
380
395
|
if (cameraDevice) {
|
|
@@ -384,10 +399,12 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
384
399
|
this.meetingStartRequest.cameraDevice = undefined;
|
|
385
400
|
}
|
|
386
401
|
}
|
|
387
|
-
|
|
388
|
-
|
|
402
|
+
_d.label = 4;
|
|
403
|
+
case 4:
|
|
404
|
+
if ((!isAudioInDeviceFound && canFetchAudioIn) || (!isCameraDeviceFound && canFetchVideoIn)) {
|
|
405
|
+
this.startLocalStream(!isCameraDeviceFound && canFetchVideoIn, !isAudioInDeviceFound && canFetchAudioIn, true);
|
|
389
406
|
}
|
|
390
|
-
(
|
|
407
|
+
(_c = this.communicationHandler) === null || _c === void 0 ? void 0 : _c.emitMessageToSource(VaniEvent.OnDevicesChanged, {});
|
|
391
408
|
return [2 /*return*/];
|
|
392
409
|
}
|
|
393
410
|
});
|