@whereby.com/media 2.5.1 → 2.5.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.
package/dist/index.cjs CHANGED
@@ -7144,10 +7144,15 @@ function getStream(constraintOpt_1) {
7144
7144
  const stopTracks = isMobile || only !== "video";
7145
7145
  const constraints = getConstraints(constraintOpt);
7146
7146
  const addDetails = (err, orgErr) => {
7147
- err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7148
- fallback,
7149
- stopTracks }, (err !== error && { error: String(error) }));
7150
- return err;
7147
+ if (err) {
7148
+ err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7149
+ fallback,
7150
+ stopTracks }, (err !== error && { error: String(error) }));
7151
+ return err;
7152
+ }
7153
+ else {
7154
+ return new Error("Unknown error");
7155
+ }
7151
7156
  };
7152
7157
  const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7153
7158
  if (constraints.audio && constraints.video) {
@@ -7155,7 +7160,7 @@ function getStream(constraintOpt_1) {
7155
7160
  stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7156
7161
  }
7157
7162
  catch (e2) {
7158
- if (e2.name !== "NotFoundError") {
7163
+ if ((e2 === null || e2 === void 0 ? void 0 : e2.name) !== "NotFoundError") {
7159
7164
  addDetails(e2, e);
7160
7165
  }
7161
7166
  }
@@ -7178,7 +7183,7 @@ function getStream(constraintOpt_1) {
7178
7183
  if (!fallback) {
7179
7184
  throw addDetails(e);
7180
7185
  }
7181
- if (e.name === "OverconstrainedError") {
7186
+ if ((e === null || e === void 0 ? void 0 : e.name) === "OverconstrainedError") {
7182
7187
  const laxConstraints = {
7183
7188
  deviceId: { videoId: null, audioId: null },
7184
7189
  width: { lax: true },
@@ -7187,15 +7192,15 @@ function getStream(constraintOpt_1) {
7187
7192
  };
7188
7193
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7189
7194
  }
7190
- else if (e.name === "NotFoundError") {
7195
+ else if ((e === null || e === void 0 ? void 0 : e.name) === "NotFoundError") {
7191
7196
  yield getSingleStream(e);
7192
7197
  }
7193
- else if (e.name === "NotAllowedError" || e.name === "NotReadableError" || e.name === "AbortError") {
7198
+ 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") {
7194
7199
  if (replaceStream && !stopTracks) {
7195
7200
  stopStreamTracks(replaceStream, only);
7196
7201
  retryConstraintOpt = constraintOpt;
7197
7202
  }
7198
- if (e.name === "NotAllowedError") {
7203
+ if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError") {
7199
7204
  yield getSingleStream(e);
7200
7205
  }
7201
7206
  else if (e.name !== "NotAllowedError") {
@@ -7230,6 +7235,9 @@ function getStream(constraintOpt_1) {
7230
7235
  }
7231
7236
  }
7232
7237
  }
7238
+ else if (!e) {
7239
+ yield getSingleStream(e);
7240
+ }
7233
7241
  }
7234
7242
  if (retryConstraintOpt) {
7235
7243
  const onlyConstraints = only ? { audio: { videoId: false }, video: { audioId: false } }[only] : {};
package/dist/index.mjs CHANGED
@@ -7123,10 +7123,15 @@ function getStream(constraintOpt_1) {
7123
7123
  const stopTracks = isMobile || only !== "video";
7124
7124
  const constraints = getConstraints(constraintOpt);
7125
7125
  const addDetails = (err, orgErr) => {
7126
- err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7127
- fallback,
7128
- stopTracks }, (err !== error && { error: String(error) }));
7129
- return err;
7126
+ if (err) {
7127
+ err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7128
+ fallback,
7129
+ stopTracks }, (err !== error && { error: String(error) }));
7130
+ return err;
7131
+ }
7132
+ else {
7133
+ return new Error("Unknown error");
7134
+ }
7130
7135
  };
7131
7136
  const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7132
7137
  if (constraints.audio && constraints.video) {
@@ -7134,7 +7139,7 @@ function getStream(constraintOpt_1) {
7134
7139
  stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7135
7140
  }
7136
7141
  catch (e2) {
7137
- if (e2.name !== "NotFoundError") {
7142
+ if ((e2 === null || e2 === void 0 ? void 0 : e2.name) !== "NotFoundError") {
7138
7143
  addDetails(e2, e);
7139
7144
  }
7140
7145
  }
@@ -7157,7 +7162,7 @@ function getStream(constraintOpt_1) {
7157
7162
  if (!fallback) {
7158
7163
  throw addDetails(e);
7159
7164
  }
7160
- if (e.name === "OverconstrainedError") {
7165
+ if ((e === null || e === void 0 ? void 0 : e.name) === "OverconstrainedError") {
7161
7166
  const laxConstraints = {
7162
7167
  deviceId: { videoId: null, audioId: null },
7163
7168
  width: { lax: true },
@@ -7166,15 +7171,15 @@ function getStream(constraintOpt_1) {
7166
7171
  };
7167
7172
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7168
7173
  }
7169
- else if (e.name === "NotFoundError") {
7174
+ else if ((e === null || e === void 0 ? void 0 : e.name) === "NotFoundError") {
7170
7175
  yield getSingleStream(e);
7171
7176
  }
7172
- else if (e.name === "NotAllowedError" || e.name === "NotReadableError" || e.name === "AbortError") {
7177
+ 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") {
7173
7178
  if (replaceStream && !stopTracks) {
7174
7179
  stopStreamTracks(replaceStream, only);
7175
7180
  retryConstraintOpt = constraintOpt;
7176
7181
  }
7177
- if (e.name === "NotAllowedError") {
7182
+ if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError") {
7178
7183
  yield getSingleStream(e);
7179
7184
  }
7180
7185
  else if (e.name !== "NotAllowedError") {
@@ -7209,6 +7214,9 @@ function getStream(constraintOpt_1) {
7209
7214
  }
7210
7215
  }
7211
7216
  }
7217
+ else if (!e) {
7218
+ yield getSingleStream(e);
7219
+ }
7212
7220
  }
7213
7221
  if (retryConstraintOpt) {
7214
7222
  const onlyConstraints = only ? { audio: { videoId: false }, video: { audioId: false } }[only] : {};
@@ -7123,10 +7123,15 @@ function getStream(constraintOpt_1) {
7123
7123
  const stopTracks = isMobile || only !== "video";
7124
7124
  const constraints = getConstraints(constraintOpt);
7125
7125
  const addDetails = (err, orgErr) => {
7126
- err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7127
- fallback,
7128
- stopTracks }, (err !== error && { error: String(error) }));
7129
- return err;
7126
+ if (err) {
7127
+ err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
7128
+ fallback,
7129
+ stopTracks }, (err !== error && { error: String(error) }));
7130
+ return err;
7131
+ }
7132
+ else {
7133
+ return new Error("Unknown error");
7134
+ }
7130
7135
  };
7131
7136
  const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
7132
7137
  if (constraints.audio && constraints.video) {
@@ -7134,7 +7139,7 @@ function getStream(constraintOpt_1) {
7134
7139
  stream = yield getUserMedia(getConstraints(Object.assign(Object.assign({}, constraintOpt), { audioId: false })));
7135
7140
  }
7136
7141
  catch (e2) {
7137
- if (e2.name !== "NotFoundError") {
7142
+ if ((e2 === null || e2 === void 0 ? void 0 : e2.name) !== "NotFoundError") {
7138
7143
  addDetails(e2, e);
7139
7144
  }
7140
7145
  }
@@ -7157,7 +7162,7 @@ function getStream(constraintOpt_1) {
7157
7162
  if (!fallback) {
7158
7163
  throw addDetails(e);
7159
7164
  }
7160
- if (e.name === "OverconstrainedError") {
7165
+ if ((e === null || e === void 0 ? void 0 : e.name) === "OverconstrainedError") {
7161
7166
  const laxConstraints = {
7162
7167
  deviceId: { videoId: null, audioId: null },
7163
7168
  width: { lax: true },
@@ -7166,15 +7171,15 @@ function getStream(constraintOpt_1) {
7166
7171
  };
7167
7172
  retryConstraintOpt = laxConstraints[e.constraint || ""];
7168
7173
  }
7169
- else if (e.name === "NotFoundError") {
7174
+ else if ((e === null || e === void 0 ? void 0 : e.name) === "NotFoundError") {
7170
7175
  yield getSingleStream(e);
7171
7176
  }
7172
- else if (e.name === "NotAllowedError" || e.name === "NotReadableError" || e.name === "AbortError") {
7177
+ 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") {
7173
7178
  if (replaceStream && !stopTracks) {
7174
7179
  stopStreamTracks(replaceStream, only);
7175
7180
  retryConstraintOpt = constraintOpt;
7176
7181
  }
7177
- if (e.name === "NotAllowedError") {
7182
+ if ((e === null || e === void 0 ? void 0 : e.name) === "NotAllowedError") {
7178
7183
  yield getSingleStream(e);
7179
7184
  }
7180
7185
  else if (e.name !== "NotAllowedError") {
@@ -7209,6 +7214,9 @@ function getStream(constraintOpt_1) {
7209
7214
  }
7210
7215
  }
7211
7216
  }
7217
+ else if (!e) {
7218
+ yield getSingleStream(e);
7219
+ }
7212
7220
  }
7213
7221
  if (retryConstraintOpt) {
7214
7222
  const onlyConstraints = only ? { audio: { videoId: false }, video: { audioId: false } }[only] : {};
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": "2.5.1",
4
+ "version": "2.5.2",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {