@webex/web-client-media-engine 1.40.3 → 1.40.4
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/dist/cjs/index.js +128 -125
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +128 -125
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -477,6 +477,133 @@ var media = /*#__PURE__*/Object.freeze({
|
|
|
477
477
|
ensureDevicePermissions: ensureDevicePermissions
|
|
478
478
|
});
|
|
479
479
|
|
|
480
|
+
var ErrorTypes;
|
|
481
|
+
(function (ErrorTypes) {
|
|
482
|
+
ErrorTypes["DEVICE_PERMISSION_DENIED"] = "DEVICE_PERMISSION_DENIED";
|
|
483
|
+
ErrorTypes["CREATE_CAMERA_TRACK_FAILED"] = "CREATE_CAMERA_TRACK_FAILED";
|
|
484
|
+
ErrorTypes["CREATE_MICROPHONE_TRACK_FAILED"] = "CREATE_MICROPHONE_TRACK_FAILED";
|
|
485
|
+
})(ErrorTypes || (ErrorTypes = {}));
|
|
486
|
+
/**
|
|
487
|
+
* Represents a WCME error, which contains error type and error message.
|
|
488
|
+
*/
|
|
489
|
+
class WcmeError {
|
|
490
|
+
/**
|
|
491
|
+
* Creates new error.
|
|
492
|
+
*
|
|
493
|
+
* @param type - Error type.
|
|
494
|
+
* @param message - Error message.
|
|
495
|
+
*/
|
|
496
|
+
constructor(type, message = '') {
|
|
497
|
+
this.type = type;
|
|
498
|
+
this.message = message;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Creates a camera video track. Please note that the constraint params in second getUserMedia call would NOT take effect when:
|
|
503
|
+
*
|
|
504
|
+
* 1. Previous captured video track from the same device is not stopped .
|
|
505
|
+
* 2. Previous createCameraTrack() call for the same device is in progress.
|
|
506
|
+
*
|
|
507
|
+
* @param constructor - Constructor for the local camera track.
|
|
508
|
+
* @param constraints - Video device constraints.
|
|
509
|
+
* @returns A LocalTrack object or an error.
|
|
510
|
+
*/
|
|
511
|
+
function createCameraTrack(constructor, constraints) {
|
|
512
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
513
|
+
let stream;
|
|
514
|
+
try {
|
|
515
|
+
stream = yield getUserMedia({ video: Object.assign({}, constraints) });
|
|
516
|
+
}
|
|
517
|
+
catch (error) {
|
|
518
|
+
throw new WcmeError(ErrorTypes.CREATE_CAMERA_TRACK_FAILED, `Failed to create camera track ${error}`);
|
|
519
|
+
}
|
|
520
|
+
return new constructor(stream);
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Creates a microphone audio track.
|
|
525
|
+
*
|
|
526
|
+
* @param constructor - Constructor for the local microphone track.
|
|
527
|
+
* @param constraints - Audio device constraints.
|
|
528
|
+
* @returns A LocalTrack object or an error.
|
|
529
|
+
*/
|
|
530
|
+
function createMicrophoneTrack(constructor, constraints) {
|
|
531
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
532
|
+
let stream;
|
|
533
|
+
try {
|
|
534
|
+
stream = yield getUserMedia({ audio: Object.assign({}, constraints) });
|
|
535
|
+
}
|
|
536
|
+
catch (error) {
|
|
537
|
+
throw new WcmeError(ErrorTypes.CREATE_MICROPHONE_TRACK_FAILED, `Failed to create microphone track ${error}`);
|
|
538
|
+
}
|
|
539
|
+
return new constructor(stream);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Creates a display video track.
|
|
544
|
+
*
|
|
545
|
+
* @param constructor - Constructor for the local display track.
|
|
546
|
+
* @returns A Promise that resolves to a LocalDisplayTrack.
|
|
547
|
+
*/
|
|
548
|
+
function createDisplayTrack(constructor) {
|
|
549
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
550
|
+
const stream = yield getDisplayMedia({ video: true });
|
|
551
|
+
return new constructor(stream);
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Enumerates the media input and output devices available.
|
|
556
|
+
*
|
|
557
|
+
* @param deviceKind - Optional filter to return a specific device kind.
|
|
558
|
+
* @returns List of media devices in an array of MediaDeviceInfo objects.
|
|
559
|
+
*/
|
|
560
|
+
function getDevices(deviceKind) {
|
|
561
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
562
|
+
let devices;
|
|
563
|
+
try {
|
|
564
|
+
devices = yield ensureDevicePermissions([DeviceKind.AudioInput, DeviceKind.VideoInput], enumerateDevices);
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
throw new WcmeError(ErrorTypes.DEVICE_PERMISSION_DENIED, 'Failed to ensure device permissions');
|
|
568
|
+
}
|
|
569
|
+
return devices.filter((v) => (deviceKind ? v.kind === deviceKind : true));
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Helper function to get a list of microphone devices.
|
|
574
|
+
*
|
|
575
|
+
* @returns List of microphone devices in an array of MediaDeviceInfo objects.
|
|
576
|
+
*/
|
|
577
|
+
function getAudioInputDevices() {
|
|
578
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
579
|
+
return getDevices(DeviceKind.AudioInput);
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Helper function to get a list of speaker devices.
|
|
584
|
+
*
|
|
585
|
+
* @returns List of speaker devices in an array of MediaDeviceInfo objects.
|
|
586
|
+
*/
|
|
587
|
+
function getAudioOutputDevices() {
|
|
588
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
589
|
+
return getDevices(DeviceKind.AudioOutput);
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Helper function to get a list of camera devices.
|
|
594
|
+
*
|
|
595
|
+
* @returns List of camera devices in an array of MediaDeviceInfo objects.
|
|
596
|
+
*/
|
|
597
|
+
function getVideoInputDevices() {
|
|
598
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
599
|
+
return getDevices(DeviceKind.VideoInput);
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Export the setOnDeviceChangeHandler method directly from the core lib.
|
|
604
|
+
*/
|
|
605
|
+
const { setOnDeviceChangeHandler } = media;
|
|
606
|
+
|
|
480
607
|
var events$1 = {exports: {}};
|
|
481
608
|
|
|
482
609
|
var R$1 = typeof Reflect === 'object' ? Reflect : null;
|
|
@@ -1235,130 +1362,6 @@ class LocalDisplayTrack extends LocalTrack {
|
|
|
1235
1362
|
class LocalMicrophoneTrack extends LocalTrack {
|
|
1236
1363
|
}
|
|
1237
1364
|
|
|
1238
|
-
var ErrorTypes;
|
|
1239
|
-
(function (ErrorTypes) {
|
|
1240
|
-
ErrorTypes["DEVICE_PERMISSION_DENIED"] = "DEVICE_PERMISSION_DENIED";
|
|
1241
|
-
ErrorTypes["CREATE_CAMERA_TRACK_FAILED"] = "CREATE_CAMERA_TRACK_FAILED";
|
|
1242
|
-
ErrorTypes["CREATE_MICROPHONE_TRACK_FAILED"] = "CREATE_MICROPHONE_TRACK_FAILED";
|
|
1243
|
-
})(ErrorTypes || (ErrorTypes = {}));
|
|
1244
|
-
/**
|
|
1245
|
-
* Represents a WCME error, which contains error type and error message.
|
|
1246
|
-
*/
|
|
1247
|
-
class WcmeError {
|
|
1248
|
-
/**
|
|
1249
|
-
* Creates new error.
|
|
1250
|
-
*
|
|
1251
|
-
* @param type - Error type.
|
|
1252
|
-
* @param message - Error message.
|
|
1253
|
-
*/
|
|
1254
|
-
constructor(type, message = '') {
|
|
1255
|
-
this.type = type;
|
|
1256
|
-
this.message = message;
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
/**
|
|
1260
|
-
* Creates a camera video track. Please note that the constraint params in second getUserMedia call would NOT take effect when:
|
|
1261
|
-
*
|
|
1262
|
-
* 1. Previous captured video track from the same device is not stopped .
|
|
1263
|
-
* 2. Previous createCameraTrack() call for the same device is in progress.
|
|
1264
|
-
*
|
|
1265
|
-
* @param constraints - Video device constraints.
|
|
1266
|
-
* @returns A LocalTrack object or an error.
|
|
1267
|
-
*/
|
|
1268
|
-
function createCameraTrack(constraints) {
|
|
1269
|
-
return __awaiter$1(this, void 0, void 0, function* () {
|
|
1270
|
-
let stream;
|
|
1271
|
-
try {
|
|
1272
|
-
stream = yield getUserMedia({ video: Object.assign({}, constraints) });
|
|
1273
|
-
}
|
|
1274
|
-
catch (error) {
|
|
1275
|
-
throw new WcmeError(ErrorTypes.CREATE_CAMERA_TRACK_FAILED, `Failed to create camera track ${error}`);
|
|
1276
|
-
}
|
|
1277
|
-
return new LocalCameraTrack(stream);
|
|
1278
|
-
});
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* Creates a microphone audio track.
|
|
1282
|
-
*
|
|
1283
|
-
* @param constraints - Audio device constraints.
|
|
1284
|
-
* @returns A LocalTrack object or an error.
|
|
1285
|
-
*/
|
|
1286
|
-
function createMicrophoneTrack(constraints) {
|
|
1287
|
-
return __awaiter$1(this, void 0, void 0, function* () {
|
|
1288
|
-
let stream;
|
|
1289
|
-
try {
|
|
1290
|
-
stream = yield getUserMedia({ audio: Object.assign({}, constraints) });
|
|
1291
|
-
}
|
|
1292
|
-
catch (error) {
|
|
1293
|
-
throw new WcmeError(ErrorTypes.CREATE_MICROPHONE_TRACK_FAILED, `Failed to create microphone track ${error}`);
|
|
1294
|
-
}
|
|
1295
|
-
return new LocalMicrophoneTrack(stream);
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
|
-
/**
|
|
1299
|
-
* Creates a display video track.
|
|
1300
|
-
*
|
|
1301
|
-
* @returns A Promise that resolves to a LocalDisplayTrack.
|
|
1302
|
-
*/
|
|
1303
|
-
function createDisplayTrack() {
|
|
1304
|
-
return __awaiter$1(this, void 0, void 0, function* () {
|
|
1305
|
-
const stream = yield getDisplayMedia({ video: true });
|
|
1306
|
-
return new LocalDisplayTrack(stream);
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
/**
|
|
1310
|
-
* Enumerates the media input and output devices available.
|
|
1311
|
-
*
|
|
1312
|
-
* @param deviceKind - Optional filter to return a specific device kind.
|
|
1313
|
-
* @returns List of media devices in an array of MediaDeviceInfo objects.
|
|
1314
|
-
*/
|
|
1315
|
-
function getDevices(deviceKind) {
|
|
1316
|
-
return __awaiter$1(this, void 0, void 0, function* () {
|
|
1317
|
-
let devices;
|
|
1318
|
-
try {
|
|
1319
|
-
devices = yield ensureDevicePermissions([DeviceKind.AudioInput, DeviceKind.VideoInput], enumerateDevices);
|
|
1320
|
-
}
|
|
1321
|
-
catch (error) {
|
|
1322
|
-
throw new WcmeError(ErrorTypes.DEVICE_PERMISSION_DENIED, 'Failed to ensure device permissions');
|
|
1323
|
-
}
|
|
1324
|
-
return devices.filter((v) => (deviceKind ? v.kind === deviceKind : true));
|
|
1325
|
-
});
|
|
1326
|
-
}
|
|
1327
|
-
/**
|
|
1328
|
-
* Helper function to get a list of microphone devices.
|
|
1329
|
-
*
|
|
1330
|
-
* @returns List of microphone devices in an array of MediaDeviceInfo objects.
|
|
1331
|
-
*/
|
|
1332
|
-
function getAudioInputDevices() {
|
|
1333
|
-
return __awaiter$1(this, void 0, void 0, function* () {
|
|
1334
|
-
return getDevices(DeviceKind.AudioInput);
|
|
1335
|
-
});
|
|
1336
|
-
}
|
|
1337
|
-
/**
|
|
1338
|
-
* Helper function to get a list of speaker devices.
|
|
1339
|
-
*
|
|
1340
|
-
* @returns List of speaker devices in an array of MediaDeviceInfo objects.
|
|
1341
|
-
*/
|
|
1342
|
-
function getAudioOutputDevices() {
|
|
1343
|
-
return __awaiter$1(this, void 0, void 0, function* () {
|
|
1344
|
-
return getDevices(DeviceKind.AudioOutput);
|
|
1345
|
-
});
|
|
1346
|
-
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Helper function to get a list of camera devices.
|
|
1349
|
-
*
|
|
1350
|
-
* @returns List of camera devices in an array of MediaDeviceInfo objects.
|
|
1351
|
-
*/
|
|
1352
|
-
function getVideoInputDevices() {
|
|
1353
|
-
return __awaiter$1(this, void 0, void 0, function* () {
|
|
1354
|
-
return getDevices(DeviceKind.VideoInput);
|
|
1355
|
-
});
|
|
1356
|
-
}
|
|
1357
|
-
/**
|
|
1358
|
-
* Export the setOnDeviceChangeHandler method directly from the core lib.
|
|
1359
|
-
*/
|
|
1360
|
-
const { setOnDeviceChangeHandler } = media;
|
|
1361
|
-
|
|
1362
1365
|
// Overall connection state (based on the ICE and DTLS connection states)
|
|
1363
1366
|
var ConnectionState;
|
|
1364
1367
|
(function (ConnectionState) {
|
|
@@ -10365,7 +10368,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10365
10368
|
}
|
|
10366
10369
|
renewPeerConnection(userOptions) {
|
|
10367
10370
|
if (userOptions) {
|
|
10368
|
-
this.options = Object.assign(Object.assign({},
|
|
10371
|
+
this.options = Object.assign(Object.assign({}, this.options), userOptions);
|
|
10369
10372
|
}
|
|
10370
10373
|
logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
|
|
10371
10374
|
this.clearMids();
|