@stream-io/video-client 1.59.0 → 2.0.0-beta.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/CHANGELOG.md +7 -0
- package/dist/index.browser.es.js +52 -9
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +52 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +52 -9
- package/dist/index.es.js.map +1 -1
- package/dist/src/coordinator/connection/utils.d.ts +10 -0
- package/dist/src/sorting/participants.d.ts +13 -0
- package/package.json +1 -1
- package/src/__tests__/StreamVideoClient.ringing.test.ts +32 -20
- package/src/coordinator/connection/__tests__/eventListenerIsolation.test.ts +115 -0
- package/src/coordinator/connection/client.ts +3 -2
- package/src/coordinator/connection/utils.ts +28 -0
- package/src/sorting/__tests__/presets.test.ts +188 -3
- package/src/sorting/__tests__/sorting.test.ts +22 -1
- package/src/sorting/participants.ts +20 -0
- package/src/sorting/presets.ts +4 -0
- package/src/store/__tests__/CallState.test.ts +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -4431,6 +4431,28 @@ function isErrorResponse(res) {
|
|
|
4431
4431
|
function isCloseEvent(res) {
|
|
4432
4432
|
return res.code !== undefined;
|
|
4433
4433
|
}
|
|
4434
|
+
/**
|
|
4435
|
+
* Invokes a single event listener in isolation, so that a faulty listener
|
|
4436
|
+
* cannot abort the dispatch loop nor the bookkeeping that follows it.
|
|
4437
|
+
*
|
|
4438
|
+
* @param listener the listener to invoke.
|
|
4439
|
+
* @param event the event to pass to the listener.
|
|
4440
|
+
* @param logger the logger to report listener failures with.
|
|
4441
|
+
*/
|
|
4442
|
+
const invokeEventListener = (listener, event, logger) => {
|
|
4443
|
+
try {
|
|
4444
|
+
const result = listener(event);
|
|
4445
|
+
if (result && typeof result.then === 'function') {
|
|
4446
|
+
Promise.resolve(result).catch((error) => report(logger, error, event));
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
catch (error) {
|
|
4450
|
+
report(logger, error, event);
|
|
4451
|
+
}
|
|
4452
|
+
};
|
|
4453
|
+
const report = (logger, error, event) => {
|
|
4454
|
+
logger.error('Unhandled error in event listener', error, event);
|
|
4455
|
+
};
|
|
4434
4456
|
|
|
4435
4457
|
/**
|
|
4436
4458
|
* Checks whether we are using React Native
|
|
@@ -5079,7 +5101,7 @@ const toIceCandidate = (iceTrickle) => {
|
|
|
5079
5101
|
}
|
|
5080
5102
|
};
|
|
5081
5103
|
|
|
5082
|
-
const version = "
|
|
5104
|
+
const version = "2.0.0-beta.0";
|
|
5083
5105
|
const [major, minor, patch] = version.split('.');
|
|
5084
5106
|
let sdkInfo = {
|
|
5085
5107
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -5928,6 +5950,27 @@ const publishingAudio = (a, b) => {
|
|
|
5928
5950
|
return 1;
|
|
5929
5951
|
return 0;
|
|
5930
5952
|
};
|
|
5953
|
+
/**
|
|
5954
|
+
* A comparator which prioritizes participants who are publishing any track
|
|
5955
|
+
* over participants who are not publishing at all.
|
|
5956
|
+
*
|
|
5957
|
+
* Unlike `publishingVideo` and `publishingAudio`, this comparator does not
|
|
5958
|
+
* distinguish between track types. Muting the microphone or turning off the
|
|
5959
|
+
* camera does not change a participant's rank as long as they still publish
|
|
5960
|
+
* something, which keeps the ordering stable across ordinary device toggles.
|
|
5961
|
+
*
|
|
5962
|
+
* @param a the first participant.
|
|
5963
|
+
* @param b the second participant.
|
|
5964
|
+
*/
|
|
5965
|
+
const publishing = (a, b) => {
|
|
5966
|
+
const hasA = a.publishedTracks.length > 0;
|
|
5967
|
+
const hasB = b.publishedTracks.length > 0;
|
|
5968
|
+
if (hasA && !hasB)
|
|
5969
|
+
return -1;
|
|
5970
|
+
if (!hasA && hasB)
|
|
5971
|
+
return 1;
|
|
5972
|
+
return 0;
|
|
5973
|
+
};
|
|
5931
5974
|
/**
|
|
5932
5975
|
* A comparator which prioritizes participants who are pinned.
|
|
5933
5976
|
*
|
|
@@ -6038,11 +6081,11 @@ const withVideoIngressSource = withParticipantSource(ParticipantSource.RTMP, Par
|
|
|
6038
6081
|
/**
|
|
6039
6082
|
* The default sorting preset.
|
|
6040
6083
|
*/
|
|
6041
|
-
const defaultSortPreset = combineComparators(screenSharing, pinned, ifInvisibleBy(combineComparators(dominantSpeaker, speaking, reactionType('raised-hand'), publishingVideo, publishingAudio)));
|
|
6084
|
+
const defaultSortPreset = combineComparators(screenSharing, pinned, publishing, ifInvisibleBy(combineComparators(dominantSpeaker, speaking, reactionType('raised-hand'), publishingVideo, publishingAudio)));
|
|
6042
6085
|
/**
|
|
6043
6086
|
* The sorting preset for speaker layout.
|
|
6044
6087
|
*/
|
|
6045
|
-
const speakerLayoutSortPreset = combineComparators(screenSharing, pinned, dominantSpeaker, ifInvisibleBy(combineComparators(speaking, reactionType('raised-hand'), withVideoIngressSource, publishingVideo, publishingAudio)));
|
|
6088
|
+
const speakerLayoutSortPreset = combineComparators(screenSharing, pinned, dominantSpeaker, publishing, ifInvisibleBy(combineComparators(speaking, reactionType('raised-hand'), withVideoIngressSource, publishingVideo, publishingAudio)));
|
|
6046
6089
|
/**
|
|
6047
6090
|
* The sorting preset for layouts that don't render all participants but
|
|
6048
6091
|
* instead, render them in pages.
|
|
@@ -6051,7 +6094,7 @@ const paginatedLayoutSortPreset = combineComparators(pinned, ifInvisibleOrUnknow
|
|
|
6051
6094
|
/**
|
|
6052
6095
|
* The sorting preset for livestreams and audio rooms.
|
|
6053
6096
|
*/
|
|
6054
|
-
const livestreamOrAudioRoomSortPreset = combineComparators(ifInvisibleOrUnknownBy(combineComparators(dominantSpeaker, speaking, reactionType('raised-hand'), withVideoIngressSource, publishingVideo, publishingAudio)), role('admin', 'host', 'speaker'));
|
|
6097
|
+
const livestreamOrAudioRoomSortPreset = combineComparators(publishing, ifInvisibleOrUnknownBy(combineComparators(dominantSpeaker, speaking, reactionType('raised-hand'), withVideoIngressSource, publishingVideo, publishingAudio)), role('admin', 'host', 'speaker'));
|
|
6055
6098
|
|
|
6056
6099
|
/**
|
|
6057
6100
|
* Returns the default egress object - when no egress data is available.
|
|
@@ -19010,11 +19053,11 @@ class StreamClient {
|
|
|
19010
19053
|
return;
|
|
19011
19054
|
// call generic listeners
|
|
19012
19055
|
for (const listener of this.listeners.all || []) {
|
|
19013
|
-
listener
|
|
19056
|
+
invokeEventListener(listener, event, this.logger);
|
|
19014
19057
|
}
|
|
19015
19058
|
// call type specific listeners
|
|
19016
19059
|
for (const listener of this.listeners[event.type] || []) {
|
|
19017
|
-
listener
|
|
19060
|
+
invokeEventListener(listener, event, this.logger);
|
|
19018
19061
|
}
|
|
19019
19062
|
};
|
|
19020
19063
|
/**
|
|
@@ -19034,11 +19077,11 @@ class StreamClient {
|
|
|
19034
19077
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
19035
19078
|
};
|
|
19036
19079
|
getSdkVersion = () => this.options.clientAppIdentifier?.sdkVersion ||
|
|
19037
|
-
"
|
|
19080
|
+
"2.0.0-beta.0";
|
|
19038
19081
|
getUserAgent = () => {
|
|
19039
19082
|
if (!this.cachedUserAgent) {
|
|
19040
19083
|
const { clientAppIdentifier = {} } = this.options;
|
|
19041
|
-
const { sdkName = 'js', sdkVersion = "
|
|
19084
|
+
const { sdkName = 'js', sdkVersion = "2.0.0-beta.0", ...extras } = clientAppIdentifier;
|
|
19042
19085
|
this.cachedUserAgent = [
|
|
19043
19086
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
19044
19087
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|
|
@@ -20949,6 +20992,7 @@ exports.name = name;
|
|
|
20949
20992
|
exports.noopComparator = noopComparator;
|
|
20950
20993
|
exports.paginatedLayoutSortPreset = paginatedLayoutSortPreset;
|
|
20951
20994
|
exports.pinned = pinned;
|
|
20995
|
+
exports.publishing = publishing;
|
|
20952
20996
|
exports.publishingAudio = publishingAudio;
|
|
20953
20997
|
exports.publishingVideo = publishingVideo;
|
|
20954
20998
|
exports.reactionType = reactionType;
|