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