@stream-io/video-client 1.16.5 → 1.16.7
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/CHANGELOG.md +14 -0
- package/dist/index.browser.es.js +27 -22
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +27 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/devices/CameraManager.ts +7 -10
- package/src/devices/devices.ts +22 -11
package/dist/index.cjs.js
CHANGED
|
@@ -7466,7 +7466,7 @@ const aggregate = (stats) => {
|
|
|
7466
7466
|
return report;
|
|
7467
7467
|
};
|
|
7468
7468
|
|
|
7469
|
-
const version = "1.16.
|
|
7469
|
+
const version = "1.16.7";
|
|
7470
7470
|
const [major, minor, patch] = version.split('.');
|
|
7471
7471
|
let sdkInfo = {
|
|
7472
7472
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -8558,13 +8558,23 @@ const getStream = async (constraints) => {
|
|
|
8558
8558
|
}
|
|
8559
8559
|
return stream;
|
|
8560
8560
|
};
|
|
8561
|
-
function
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8561
|
+
function isNotFoundOrOverconstrainedError(error) {
|
|
8562
|
+
if (!error || typeof error !== 'object') {
|
|
8563
|
+
return false;
|
|
8564
|
+
}
|
|
8565
|
+
if ('name' in error && typeof error.name === 'string') {
|
|
8566
|
+
const name = error.name;
|
|
8567
|
+
if (['OverconstrainedError', 'NotFoundError'].includes(name)) {
|
|
8568
|
+
return true;
|
|
8569
|
+
}
|
|
8570
|
+
}
|
|
8571
|
+
if ('message' in error && typeof error.message === 'string') {
|
|
8572
|
+
const message = error.message;
|
|
8573
|
+
if (message.startsWith('OverconstrainedError')) {
|
|
8574
|
+
return true;
|
|
8575
|
+
}
|
|
8576
|
+
}
|
|
8577
|
+
return false;
|
|
8568
8578
|
}
|
|
8569
8579
|
/**
|
|
8570
8580
|
* Returns an audio media stream that fulfills the given constraints.
|
|
@@ -8589,7 +8599,7 @@ const getAudioStream = async (trackConstraints) => {
|
|
|
8589
8599
|
return await getStream(constraints);
|
|
8590
8600
|
}
|
|
8591
8601
|
catch (error) {
|
|
8592
|
-
if (
|
|
8602
|
+
if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
|
|
8593
8603
|
const { deviceId, ...relaxedConstraints } = trackConstraints;
|
|
8594
8604
|
getLogger(['devices'])('warn', 'Failed to get audio stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
|
|
8595
8605
|
return getAudioStream(relaxedConstraints);
|
|
@@ -8624,7 +8634,7 @@ const getVideoStream = async (trackConstraints) => {
|
|
|
8624
8634
|
return await getStream(constraints);
|
|
8625
8635
|
}
|
|
8626
8636
|
catch (error) {
|
|
8627
|
-
if (
|
|
8637
|
+
if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
|
|
8628
8638
|
const { deviceId, ...relaxedConstraints } = trackConstraints;
|
|
8629
8639
|
getLogger(['devices'])('warn', 'Failed to get video stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
|
|
8630
8640
|
return getVideoStream(relaxedConstraints);
|
|
@@ -9325,19 +9335,14 @@ class CameraManager extends InputMediaDeviceManager {
|
|
|
9325
9335
|
if (this.isDirectionSupportedByDevice()) {
|
|
9326
9336
|
if (isReactNative()) {
|
|
9327
9337
|
const videoTrack = this.getTracks()[0];
|
|
9328
|
-
if (!videoTrack)
|
|
9338
|
+
if (!videoTrack) {
|
|
9339
|
+
this.logger('warn', 'No video track found to do direction selection');
|
|
9329
9340
|
return;
|
|
9330
|
-
// @ts-expect-error _switchCamera() is only present in react-native-webrtc 124 and below
|
|
9331
|
-
if (typeof videoTrack._switchCamera === 'function') {
|
|
9332
|
-
// @ts-expect-error for older versions of react-native-webrtc support
|
|
9333
|
-
videoTrack._switchCamera();
|
|
9334
|
-
}
|
|
9335
|
-
else {
|
|
9336
|
-
const constraints = {
|
|
9337
|
-
facingMode: direction === 'front' ? 'user' : 'environment',
|
|
9338
|
-
};
|
|
9339
|
-
await videoTrack.applyConstraints(constraints);
|
|
9340
9341
|
}
|
|
9342
|
+
const constraints = {
|
|
9343
|
+
facingMode: direction === 'front' ? 'user' : 'environment',
|
|
9344
|
+
};
|
|
9345
|
+
await videoTrack.applyConstraints(constraints);
|
|
9341
9346
|
this.state.setDirection(direction);
|
|
9342
9347
|
this.state.setDevice(undefined);
|
|
9343
9348
|
}
|
|
@@ -13072,7 +13077,7 @@ class StreamClient {
|
|
|
13072
13077
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
13073
13078
|
};
|
|
13074
13079
|
this.getUserAgent = () => {
|
|
13075
|
-
const version = "1.16.
|
|
13080
|
+
const version = "1.16.7";
|
|
13076
13081
|
return (this.userAgent ||
|
|
13077
13082
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
13078
13083
|
};
|