@whereby.com/media 1.19.0 → 1.20.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.
package/dist/index.cjs CHANGED
@@ -7753,6 +7753,25 @@ function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
7753
7753
  stopTracks }, (err !== error && { error: String(error) }));
7754
7754
  return err;
7755
7755
  };
7756
+ const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7757
+ if (constraints.audio && constraints.video) {
7758
+ try {
7759
+ stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7760
+ }
7761
+ catch (e2) {
7762
+ if (e2.name !== "NotFoundError") {
7763
+ addDetails(e2, e);
7764
+ }
7765
+ }
7766
+ try {
7767
+ if (!stream)
7768
+ stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7769
+ }
7770
+ catch (e2) {
7771
+ addDetails(e2, e);
7772
+ }
7773
+ }
7774
+ });
7756
7775
  if (stopTracks && replaceStream)
7757
7776
  stopStreamTracks(replaceStream, only);
7758
7777
  try {
@@ -7773,29 +7792,16 @@ function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
7773
7792
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7774
7793
  }
7775
7794
  else if (e.name === "NotFoundError") {
7776
- if (constraints.audio && constraints.video) {
7777
- try {
7778
- stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7779
- }
7780
- catch (e2) {
7781
- if (e2.name !== "NotFoundError") {
7782
- throw addDetails(e2, e);
7783
- }
7784
- }
7785
- try {
7786
- if (!stream)
7787
- stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7788
- }
7789
- catch (e2) {
7790
- throw addDetails(e2, e);
7791
- }
7792
- }
7795
+ yield getSingleStream(e);
7793
7796
  }
7794
7797
  else if (e.name === "NotAllowedError" || e.name === "NotReadableError" || e.name === "AbortError") {
7795
7798
  if (replaceStream && !stopTracks) {
7796
7799
  stopStreamTracks(replaceStream, only);
7797
7800
  retryConstraintOpt = constraintOpt;
7798
7801
  }
7802
+ if (e.name === "NotAllowedError") {
7803
+ yield getSingleStream(e);
7804
+ }
7799
7805
  else if (e.name !== "NotAllowedError") {
7800
7806
  try {
7801
7807
  stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { options: Object.assign(Object.assign({}, constraintOpt.options), { lax: true }) })));
package/dist/index.mjs CHANGED
@@ -7728,6 +7728,25 @@ function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
7728
7728
  stopTracks }, (err !== error && { error: String(error) }));
7729
7729
  return err;
7730
7730
  };
7731
+ const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7732
+ if (constraints.audio && constraints.video) {
7733
+ try {
7734
+ stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7735
+ }
7736
+ catch (e2) {
7737
+ if (e2.name !== "NotFoundError") {
7738
+ addDetails(e2, e);
7739
+ }
7740
+ }
7741
+ try {
7742
+ if (!stream)
7743
+ stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7744
+ }
7745
+ catch (e2) {
7746
+ addDetails(e2, e);
7747
+ }
7748
+ }
7749
+ });
7731
7750
  if (stopTracks && replaceStream)
7732
7751
  stopStreamTracks(replaceStream, only);
7733
7752
  try {
@@ -7748,29 +7767,16 @@ function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
7748
7767
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7749
7768
  }
7750
7769
  else if (e.name === "NotFoundError") {
7751
- if (constraints.audio && constraints.video) {
7752
- try {
7753
- stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7754
- }
7755
- catch (e2) {
7756
- if (e2.name !== "NotFoundError") {
7757
- throw addDetails(e2, e);
7758
- }
7759
- }
7760
- try {
7761
- if (!stream)
7762
- stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7763
- }
7764
- catch (e2) {
7765
- throw addDetails(e2, e);
7766
- }
7767
- }
7770
+ yield getSingleStream(e);
7768
7771
  }
7769
7772
  else if (e.name === "NotAllowedError" || e.name === "NotReadableError" || e.name === "AbortError") {
7770
7773
  if (replaceStream && !stopTracks) {
7771
7774
  stopStreamTracks(replaceStream, only);
7772
7775
  retryConstraintOpt = constraintOpt;
7773
7776
  }
7777
+ if (e.name === "NotAllowedError") {
7778
+ yield getSingleStream(e);
7779
+ }
7774
7780
  else if (e.name !== "NotAllowedError") {
7775
7781
  try {
7776
7782
  stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { options: Object.assign(Object.assign({}, constraintOpt.options), { lax: true }) })));
@@ -7728,6 +7728,25 @@ function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
7728
7728
  stopTracks }, (err !== error && { error: String(error) }));
7729
7729
  return err;
7730
7730
  };
7731
+ const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7732
+ if (constraints.audio && constraints.video) {
7733
+ try {
7734
+ stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7735
+ }
7736
+ catch (e2) {
7737
+ if (e2.name !== "NotFoundError") {
7738
+ addDetails(e2, e);
7739
+ }
7740
+ }
7741
+ try {
7742
+ if (!stream)
7743
+ stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7744
+ }
7745
+ catch (e2) {
7746
+ addDetails(e2, e);
7747
+ }
7748
+ }
7749
+ });
7731
7750
  if (stopTracks && replaceStream)
7732
7751
  stopStreamTracks(replaceStream, only);
7733
7752
  try {
@@ -7748,29 +7767,16 @@ function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
7748
7767
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7749
7768
  }
7750
7769
  else if (e.name === "NotFoundError") {
7751
- if (constraints.audio && constraints.video) {
7752
- try {
7753
- stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7754
- }
7755
- catch (e2) {
7756
- if (e2.name !== "NotFoundError") {
7757
- throw addDetails(e2, e);
7758
- }
7759
- }
7760
- try {
7761
- if (!stream)
7762
- stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { videoId: false })));
7763
- }
7764
- catch (e2) {
7765
- throw addDetails(e2, e);
7766
- }
7767
- }
7770
+ yield getSingleStream(e);
7768
7771
  }
7769
7772
  else if (e.name === "NotAllowedError" || e.name === "NotReadableError" || e.name === "AbortError") {
7770
7773
  if (replaceStream && !stopTracks) {
7771
7774
  stopStreamTracks(replaceStream, only);
7772
7775
  retryConstraintOpt = constraintOpt;
7773
7776
  }
7777
+ if (e.name === "NotAllowedError") {
7778
+ yield getSingleStream(e);
7779
+ }
7774
7780
  else if (e.name !== "NotAllowedError") {
7775
7781
  try {
7776
7782
  stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { options: Object.assign(Object.assign({}, constraintOpt.options), { lax: true }) })));
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": "1.19.0",
4
+ "version": "1.20.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {