@stream-io/video-client 1.7.3 → 1.7.4
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 +7 -0
- package/dist/index.browser.es.js +31 -27
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +31 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +31 -27
- package/dist/index.es.js.map +1 -1
- package/dist/src/coordinator/connection/location.d.ts +1 -1
- package/dist/src/coordinator/connection/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/coordinator/connection/client.ts +1 -0
- package/src/coordinator/connection/location.ts +28 -22
- package/src/coordinator/connection/types.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.7.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.7.3...@stream-io/video-client-1.7.4) (2024-10-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* retryable location hint ([#1505](https://github.com/GetStream/stream-video-js/issues/1505)) ([087417f](https://github.com/GetStream/stream-video-js/commit/087417f926b3d43a5bcb814ac9bb5951c1e63479))
|
|
11
|
+
|
|
5
12
|
## [1.7.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.7.2...@stream-io/video-client-1.7.3) (2024-09-24)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -2935,7 +2935,7 @@ const logLevels = Object.freeze({
|
|
|
2935
2935
|
warn: 3,
|
|
2936
2936
|
error: 4,
|
|
2937
2937
|
});
|
|
2938
|
-
let logger
|
|
2938
|
+
let logger;
|
|
2939
2939
|
let level = 'info';
|
|
2940
2940
|
const logToConsole = (logLevel, message, ...args) => {
|
|
2941
2941
|
let logMethod;
|
|
@@ -2969,7 +2969,7 @@ const logToConsole = (logLevel, message, ...args) => {
|
|
|
2969
2969
|
logMethod(message, ...args);
|
|
2970
2970
|
};
|
|
2971
2971
|
const setLogger = (l, lvl) => {
|
|
2972
|
-
logger
|
|
2972
|
+
logger = l;
|
|
2973
2973
|
if (lvl) {
|
|
2974
2974
|
setLogLevel(lvl);
|
|
2975
2975
|
}
|
|
@@ -2979,7 +2979,7 @@ const setLogLevel = (l) => {
|
|
|
2979
2979
|
};
|
|
2980
2980
|
const getLogLevel = () => level;
|
|
2981
2981
|
const getLogger = (withTags) => {
|
|
2982
|
-
const loggerMethod = logger
|
|
2982
|
+
const loggerMethod = logger || logToConsole;
|
|
2983
2983
|
const tags = (withTags || []).filter(Boolean).join(':');
|
|
2984
2984
|
const result = (logLevel, message, ...args) => {
|
|
2985
2985
|
if (logLevels[logLevel] >= logLevels[level]) {
|
|
@@ -3020,7 +3020,7 @@ const retryable = async (rpc, signal) => {
|
|
|
3020
3020
|
return result;
|
|
3021
3021
|
};
|
|
3022
3022
|
|
|
3023
|
-
const version = "1.7.
|
|
3023
|
+
const version = "1.7.4";
|
|
3024
3024
|
const [major, minor, patch] = version.split('.');
|
|
3025
3025
|
let sdkInfo = {
|
|
3026
3026
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -11908,27 +11908,31 @@ class WSConnectionFallback {
|
|
|
11908
11908
|
}
|
|
11909
11909
|
}
|
|
11910
11910
|
|
|
11911
|
-
const
|
|
11912
|
-
const
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
const
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
|
|
11911
|
+
const getLocationHint = async (hintUrl = `https://hint.stream-io-video.com/`, timeout = 2000, maxAttempts = 3) => {
|
|
11912
|
+
const logger = getLogger(['location-hint']);
|
|
11913
|
+
let attempt = 0;
|
|
11914
|
+
let locationHint = 'ERR';
|
|
11915
|
+
do {
|
|
11916
|
+
const abortController = new AbortController();
|
|
11917
|
+
const timeoutId = setTimeout(() => abortController.abort(), timeout);
|
|
11918
|
+
try {
|
|
11919
|
+
const response = await fetch(hintUrl, {
|
|
11920
|
+
method: 'HEAD',
|
|
11921
|
+
signal: abortController.signal,
|
|
11922
|
+
});
|
|
11923
|
+
const awsPop = response.headers.get('x-amz-cf-pop') || 'ERR';
|
|
11924
|
+
logger('debug', `Location header: ${awsPop}`);
|
|
11925
|
+
locationHint = awsPop.substring(0, 3); // AMS1-P2 -> AMS
|
|
11926
|
+
}
|
|
11927
|
+
catch (e) {
|
|
11928
|
+
logger('warn', `Failed to get location hint from ${hintUrl}`, e);
|
|
11929
|
+
locationHint = 'ERR';
|
|
11930
|
+
}
|
|
11931
|
+
finally {
|
|
11932
|
+
clearTimeout(timeoutId);
|
|
11933
|
+
}
|
|
11934
|
+
} while (locationHint === 'ERR' && ++attempt < maxAttempts);
|
|
11935
|
+
return locationHint;
|
|
11932
11936
|
};
|
|
11933
11937
|
|
|
11934
11938
|
class StreamClient {
|
|
@@ -12369,7 +12373,7 @@ class StreamClient {
|
|
|
12369
12373
|
});
|
|
12370
12374
|
};
|
|
12371
12375
|
this.getUserAgent = () => {
|
|
12372
|
-
const version = "1.7.
|
|
12376
|
+
const version = "1.7.4";
|
|
12373
12377
|
return (this.userAgent ||
|
|
12374
12378
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
12375
12379
|
};
|
|
@@ -12452,7 +12456,7 @@ class StreamClient {
|
|
|
12452
12456
|
this.browser = inputOptions.browser || typeof window !== 'undefined';
|
|
12453
12457
|
this.node = !this.browser;
|
|
12454
12458
|
if (this.browser) {
|
|
12455
|
-
this.locationHint = getLocationHint(options?.locationHintUrl, options?.locationHintTimeout);
|
|
12459
|
+
this.locationHint = getLocationHint(options?.locationHintUrl, options?.locationHintTimeout, options?.locationHintMaxAttempts);
|
|
12456
12460
|
}
|
|
12457
12461
|
this.options = {
|
|
12458
12462
|
timeout: 5000,
|