@whereby.com/media 9.7.0 → 9.7.1

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/index.cjs CHANGED
@@ -7437,40 +7437,24 @@ function getStream(constraintOpt_1) {
7437
7437
  return __awaiter(this, arguments, void 0, function* (constraintOpt, { replaceStream, fallback = true } = {}) {
7438
7438
  var _a;
7439
7439
  let error;
7440
- let newConstraints;
7441
7440
  let retryConstraintOpt;
7442
7441
  let stream = null;
7443
7442
  const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
7444
7443
  const only = (constraintOpt.audioId === false && "video") || (constraintOpt.videoId === false && "audio");
7445
7444
  const stopTracks = isMobile || only !== "video";
7446
7445
  const constraints = getConstraints(constraintOpt);
7447
- const addDetails = (err, orgErr) => {
7448
- if (err) {
7449
- err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7450
- fallback,
7451
- stopTracks }, (err !== error && { error: String(error) }));
7452
- return err;
7453
- }
7454
- else {
7455
- return new Error("Unknown error");
7456
- }
7457
- };
7458
- const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7446
+ const getSingleStream = () => __awaiter(this, void 0, void 0, function* () {
7459
7447
  if (constraints.audio && constraints.video) {
7460
7448
  try {
7461
7449
  stream = yield attempt(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7462
7450
  }
7463
- catch (e2) {
7464
- if ((e2 === null || e2 === void 0 ? void 0 : e2.name) !== "NotFoundError") {
7465
- addDetails(e2, e);
7466
- }
7451
+ catch (_a) {
7467
7452
  }
7468
7453
  try {
7469
7454
  if (!stream)
7470
7455
  stream = yield attempt(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7471
7456
  }
7472
- catch (e2) {
7473
- addDetails(e2, e);
7457
+ catch (_b) {
7474
7458
  }
7475
7459
  }
7476
7460
  });
@@ -7482,7 +7466,7 @@ function getStream(constraintOpt_1) {
7482
7466
  catch (e) {
7483
7467
  error = e;
7484
7468
  if (!fallback) {
7485
- throw attachAttempts(addDetails(e));
7469
+ throw attachAttempts(e || new Error("Unknown error"));
7486
7470
  }
7487
7471
  if ((e === null || e === void 0 ? void 0 : e.name) === "OverconstrainedError") {
7488
7472
  const laxConstraints = {
@@ -7494,7 +7478,7 @@ function getStream(constraintOpt_1) {
7494
7478
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7495
7479
  }
7496
7480
  else if ((e === null || e === void 0 ? void 0 : e.name) === "NotFoundError") {
7497
- yield getSingleStream(e);
7481
+ yield getSingleStream();
7498
7482
  }
7499
7483
  else if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError" || (e === null || e === void 0 ? void 0 : e.name) === "NotReadableError" || (e === null || e === void 0 ? void 0 : e.name) === "AbortError") {
7500
7484
  if (replaceStream && !stopTracks) {
@@ -7502,7 +7486,7 @@ function getStream(constraintOpt_1) {
7502
7486
  retryConstraintOpt = constraintOpt;
7503
7487
  }
7504
7488
  if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError") {
7505
- yield getSingleStream(e);
7489
+ yield getSingleStream();
7506
7490
  }
7507
7491
  else if (e.name !== "NotAllowedError") {
7508
7492
  try {
@@ -7537,22 +7521,21 @@ function getStream(constraintOpt_1) {
7537
7521
  }
7538
7522
  }
7539
7523
  else if (!e) {
7540
- yield getSingleStream(e);
7524
+ yield getSingleStream();
7541
7525
  }
7542
7526
  }
7543
7527
  if (retryConstraintOpt) {
7544
7528
  const onlyConstraints = only ? { audio: { videoId: false }, video: { audioId: false } }[only] : {};
7545
7529
  const retryConstraints = getConstraints(Object.assign(Object.assign(Object.assign(Object.assign({}, constraintOpt), retryConstraintOpt), { options: Object.assign(Object.assign({}, constraintOpt.options), { lax: retryConstraintOpt.lax }) }), onlyConstraints));
7546
- newConstraints = retryConstraints;
7547
7530
  try {
7548
7531
  stream = yield attempt(retryConstraints);
7549
7532
  }
7550
7533
  catch (e) {
7551
- throw attachAttempts(addDetails(e, error));
7534
+ throw attachAttempts(e || new Error("Unknown error"));
7552
7535
  }
7553
7536
  }
7554
7537
  if (!stream) {
7555
- throw attachAttempts(addDetails(error));
7538
+ throw attachAttempts(error || new Error("Unknown error"));
7556
7539
  }
7557
7540
  let replacedTracks;
7558
7541
  if (replaceStream) {
@@ -7561,7 +7544,7 @@ function getStream(constraintOpt_1) {
7561
7544
  replacedTracks = replaceTracksInStream(replaceStream, stream, only);
7562
7545
  stream = replaceStream;
7563
7546
  }
7564
- return { error: error && addDetails(error), stream, replacedTracks, attempts };
7547
+ return { error, stream, replacedTracks, attempts };
7565
7548
  });
7566
7549
  }
7567
7550
  function hasGetDisplayMedia() {
package/dist/index.mjs CHANGED
@@ -7417,40 +7417,24 @@ function getStream(constraintOpt_1) {
7417
7417
  return __awaiter(this, arguments, void 0, function* (constraintOpt, { replaceStream, fallback = true } = {}) {
7418
7418
  var _a;
7419
7419
  let error;
7420
- let newConstraints;
7421
7420
  let retryConstraintOpt;
7422
7421
  let stream = null;
7423
7422
  const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
7424
7423
  const only = (constraintOpt.audioId === false && "video") || (constraintOpt.videoId === false && "audio");
7425
7424
  const stopTracks = isMobile || only !== "video";
7426
7425
  const constraints = getConstraints(constraintOpt);
7427
- const addDetails = (err, orgErr) => {
7428
- if (err) {
7429
- err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7430
- fallback,
7431
- stopTracks }, (err !== error && { error: String(error) }));
7432
- return err;
7433
- }
7434
- else {
7435
- return new Error("Unknown error");
7436
- }
7437
- };
7438
- const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7426
+ const getSingleStream = () => __awaiter(this, void 0, void 0, function* () {
7439
7427
  if (constraints.audio && constraints.video) {
7440
7428
  try {
7441
7429
  stream = yield attempt(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7442
7430
  }
7443
- catch (e2) {
7444
- if ((e2 === null || e2 === void 0 ? void 0 : e2.name) !== "NotFoundError") {
7445
- addDetails(e2, e);
7446
- }
7431
+ catch (_a) {
7447
7432
  }
7448
7433
  try {
7449
7434
  if (!stream)
7450
7435
  stream = yield attempt(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7451
7436
  }
7452
- catch (e2) {
7453
- addDetails(e2, e);
7437
+ catch (_b) {
7454
7438
  }
7455
7439
  }
7456
7440
  });
@@ -7462,7 +7446,7 @@ function getStream(constraintOpt_1) {
7462
7446
  catch (e) {
7463
7447
  error = e;
7464
7448
  if (!fallback) {
7465
- throw attachAttempts(addDetails(e));
7449
+ throw attachAttempts(e || new Error("Unknown error"));
7466
7450
  }
7467
7451
  if ((e === null || e === void 0 ? void 0 : e.name) === "OverconstrainedError") {
7468
7452
  const laxConstraints = {
@@ -7474,7 +7458,7 @@ function getStream(constraintOpt_1) {
7474
7458
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7475
7459
  }
7476
7460
  else if ((e === null || e === void 0 ? void 0 : e.name) === "NotFoundError") {
7477
- yield getSingleStream(e);
7461
+ yield getSingleStream();
7478
7462
  }
7479
7463
  else if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError" || (e === null || e === void 0 ? void 0 : e.name) === "NotReadableError" || (e === null || e === void 0 ? void 0 : e.name) === "AbortError") {
7480
7464
  if (replaceStream && !stopTracks) {
@@ -7482,7 +7466,7 @@ function getStream(constraintOpt_1) {
7482
7466
  retryConstraintOpt = constraintOpt;
7483
7467
  }
7484
7468
  if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError") {
7485
- yield getSingleStream(e);
7469
+ yield getSingleStream();
7486
7470
  }
7487
7471
  else if (e.name !== "NotAllowedError") {
7488
7472
  try {
@@ -7517,22 +7501,21 @@ function getStream(constraintOpt_1) {
7517
7501
  }
7518
7502
  }
7519
7503
  else if (!e) {
7520
- yield getSingleStream(e);
7504
+ yield getSingleStream();
7521
7505
  }
7522
7506
  }
7523
7507
  if (retryConstraintOpt) {
7524
7508
  const onlyConstraints = only ? { audio: { videoId: false }, video: { audioId: false } }[only] : {};
7525
7509
  const retryConstraints = getConstraints(Object.assign(Object.assign(Object.assign(Object.assign({}, constraintOpt), retryConstraintOpt), { options: Object.assign(Object.assign({}, constraintOpt.options), { lax: retryConstraintOpt.lax }) }), onlyConstraints));
7526
- newConstraints = retryConstraints;
7527
7510
  try {
7528
7511
  stream = yield attempt(retryConstraints);
7529
7512
  }
7530
7513
  catch (e) {
7531
- throw attachAttempts(addDetails(e, error));
7514
+ throw attachAttempts(e || new Error("Unknown error"));
7532
7515
  }
7533
7516
  }
7534
7517
  if (!stream) {
7535
- throw attachAttempts(addDetails(error));
7518
+ throw attachAttempts(error || new Error("Unknown error"));
7536
7519
  }
7537
7520
  let replacedTracks;
7538
7521
  if (replaceStream) {
@@ -7541,7 +7524,7 @@ function getStream(constraintOpt_1) {
7541
7524
  replacedTracks = replaceTracksInStream(replaceStream, stream, only);
7542
7525
  stream = replaceStream;
7543
7526
  }
7544
- return { error: error && addDetails(error), stream, replacedTracks, attempts };
7527
+ return { error, stream, replacedTracks, attempts };
7545
7528
  });
7546
7529
  }
7547
7530
  function hasGetDisplayMedia() {
@@ -7417,40 +7417,24 @@ function getStream(constraintOpt_1) {
7417
7417
  return __awaiter(this, arguments, void 0, function* (constraintOpt, { replaceStream, fallback = true } = {}) {
7418
7418
  var _a;
7419
7419
  let error;
7420
- let newConstraints;
7421
7420
  let retryConstraintOpt;
7422
7421
  let stream = null;
7423
7422
  const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
7424
7423
  const only = (constraintOpt.audioId === false && "video") || (constraintOpt.videoId === false && "audio");
7425
7424
  const stopTracks = isMobile || only !== "video";
7426
7425
  const constraints = getConstraints(constraintOpt);
7427
- const addDetails = (err, orgErr) => {
7428
- if (err) {
7429
- err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7430
- fallback,
7431
- stopTracks }, (err !== error && { error: String(error) }));
7432
- return err;
7433
- }
7434
- else {
7435
- return new Error("Unknown error");
7436
- }
7437
- };
7438
- const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7426
+ const getSingleStream = () => __awaiter(this, void 0, void 0, function* () {
7439
7427
  if (constraints.audio && constraints.video) {
7440
7428
  try {
7441
7429
  stream = yield attempt(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7442
7430
  }
7443
- catch (e2) {
7444
- if ((e2 === null || e2 === void 0 ? void 0 : e2.name) !== "NotFoundError") {
7445
- addDetails(e2, e);
7446
- }
7431
+ catch (_a) {
7447
7432
  }
7448
7433
  try {
7449
7434
  if (!stream)
7450
7435
  stream = yield attempt(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7451
7436
  }
7452
- catch (e2) {
7453
- addDetails(e2, e);
7437
+ catch (_b) {
7454
7438
  }
7455
7439
  }
7456
7440
  });
@@ -7462,7 +7446,7 @@ function getStream(constraintOpt_1) {
7462
7446
  catch (e) {
7463
7447
  error = e;
7464
7448
  if (!fallback) {
7465
- throw attachAttempts(addDetails(e));
7449
+ throw attachAttempts(e || new Error("Unknown error"));
7466
7450
  }
7467
7451
  if ((e === null || e === void 0 ? void 0 : e.name) === "OverconstrainedError") {
7468
7452
  const laxConstraints = {
@@ -7474,7 +7458,7 @@ function getStream(constraintOpt_1) {
7474
7458
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7475
7459
  }
7476
7460
  else if ((e === null || e === void 0 ? void 0 : e.name) === "NotFoundError") {
7477
- yield getSingleStream(e);
7461
+ yield getSingleStream();
7478
7462
  }
7479
7463
  else if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError" || (e === null || e === void 0 ? void 0 : e.name) === "NotReadableError" || (e === null || e === void 0 ? void 0 : e.name) === "AbortError") {
7480
7464
  if (replaceStream && !stopTracks) {
@@ -7482,7 +7466,7 @@ function getStream(constraintOpt_1) {
7482
7466
  retryConstraintOpt = constraintOpt;
7483
7467
  }
7484
7468
  if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError") {
7485
- yield getSingleStream(e);
7469
+ yield getSingleStream();
7486
7470
  }
7487
7471
  else if (e.name !== "NotAllowedError") {
7488
7472
  try {
@@ -7517,22 +7501,21 @@ function getStream(constraintOpt_1) {
7517
7501
  }
7518
7502
  }
7519
7503
  else if (!e) {
7520
- yield getSingleStream(e);
7504
+ yield getSingleStream();
7521
7505
  }
7522
7506
  }
7523
7507
  if (retryConstraintOpt) {
7524
7508
  const onlyConstraints = only ? { audio: { videoId: false }, video: { audioId: false } }[only] : {};
7525
7509
  const retryConstraints = getConstraints(Object.assign(Object.assign(Object.assign(Object.assign({}, constraintOpt), retryConstraintOpt), { options: Object.assign(Object.assign({}, constraintOpt.options), { lax: retryConstraintOpt.lax }) }), onlyConstraints));
7526
- newConstraints = retryConstraints;
7527
7510
  try {
7528
7511
  stream = yield attempt(retryConstraints);
7529
7512
  }
7530
7513
  catch (e) {
7531
- throw attachAttempts(addDetails(e, error));
7514
+ throw attachAttempts(e || new Error("Unknown error"));
7532
7515
  }
7533
7516
  }
7534
7517
  if (!stream) {
7535
- throw attachAttempts(addDetails(error));
7518
+ throw attachAttempts(error || new Error("Unknown error"));
7536
7519
  }
7537
7520
  let replacedTracks;
7538
7521
  if (replaceStream) {
@@ -7541,7 +7524,7 @@ function getStream(constraintOpt_1) {
7541
7524
  replacedTracks = replaceTracksInStream(replaceStream, stream, only);
7542
7525
  stream = replaceStream;
7543
7526
  }
7544
- return { error: error && addDetails(error), stream, replacedTracks, attempts };
7527
+ return { error, stream, replacedTracks, attempts };
7545
7528
  });
7546
7529
  }
7547
7530
  function hasGetDisplayMedia() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whereby.com/media",
3
3
  "description": "Media library for Whereby",
4
- "version": "9.7.0",
4
+ "version": "9.7.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {