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