@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.es.js
CHANGED
|
@@ -4412,6 +4412,28 @@ function isErrorResponse(res) {
|
|
|
4412
4412
|
function isCloseEvent(res) {
|
|
4413
4413
|
return res.code !== undefined;
|
|
4414
4414
|
}
|
|
4415
|
+
/**
|
|
4416
|
+
* Invokes a single event listener in isolation, so that a faulty listener
|
|
4417
|
+
* cannot abort the dispatch loop nor the bookkeeping that follows it.
|
|
4418
|
+
*
|
|
4419
|
+
* @param listener the listener to invoke.
|
|
4420
|
+
* @param event the event to pass to the listener.
|
|
4421
|
+
* @param logger the logger to report listener failures with.
|
|
4422
|
+
*/
|
|
4423
|
+
const invokeEventListener = (listener, event, logger) => {
|
|
4424
|
+
try {
|
|
4425
|
+
const result = listener(event);
|
|
4426
|
+
if (result && typeof result.then === 'function') {
|
|
4427
|
+
Promise.resolve(result).catch((error) => report(logger, error, event));
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
catch (error) {
|
|
4431
|
+
report(logger, error, event);
|
|
4432
|
+
}
|
|
4433
|
+
};
|
|
4434
|
+
const report = (logger, error, event) => {
|
|
4435
|
+
logger.error('Unhandled error in event listener', error, event);
|
|
4436
|
+
};
|
|
4415
4437
|
|
|
4416
4438
|
/**
|
|
4417
4439
|
* Checks whether we are using React Native
|
|
@@ -5060,7 +5082,7 @@ const toIceCandidate = (iceTrickle) => {
|
|
|
5060
5082
|
}
|
|
5061
5083
|
};
|
|
5062
5084
|
|
|
5063
|
-
const version = "
|
|
5085
|
+
const version = "2.0.0-beta.0";
|
|
5064
5086
|
const [major, minor, patch] = version.split('.');
|
|
5065
5087
|
let sdkInfo = {
|
|
5066
5088
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -5909,6 +5931,27 @@ const publishingAudio = (a, b) => {
|
|
|
5909
5931
|
return 1;
|
|
5910
5932
|
return 0;
|
|
5911
5933
|
};
|
|
5934
|
+
/**
|
|
5935
|
+
* A comparator which prioritizes participants who are publishing any track
|
|
5936
|
+
* over participants who are not publishing at all.
|
|
5937
|
+
*
|
|
5938
|
+
* Unlike `publishingVideo` and `publishingAudio`, this comparator does not
|
|
5939
|
+
* distinguish between track types. Muting the microphone or turning off the
|
|
5940
|
+
* camera does not change a participant's rank as long as they still publish
|
|
5941
|
+
* something, which keeps the ordering stable across ordinary device toggles.
|
|
5942
|
+
*
|
|
5943
|
+
* @param a the first participant.
|
|
5944
|
+
* @param b the second participant.
|
|
5945
|
+
*/
|
|
5946
|
+
const publishing = (a, b) => {
|
|
5947
|
+
const hasA = a.publishedTracks.length > 0;
|
|
5948
|
+
const hasB = b.publishedTracks.length > 0;
|
|
5949
|
+
if (hasA && !hasB)
|
|
5950
|
+
return -1;
|
|
5951
|
+
if (!hasA && hasB)
|
|
5952
|
+
return 1;
|
|
5953
|
+
return 0;
|
|
5954
|
+
};
|
|
5912
5955
|
/**
|
|
5913
5956
|
* A comparator which prioritizes participants who are pinned.
|
|
5914
5957
|
*
|
|
@@ -6019,11 +6062,11 @@ const withVideoIngressSource = withParticipantSource(ParticipantSource.RTMP, Par
|
|
|
6019
6062
|
/**
|
|
6020
6063
|
* The default sorting preset.
|
|
6021
6064
|
*/
|
|
6022
|
-
const defaultSortPreset = combineComparators(screenSharing, pinned, ifInvisibleBy(combineComparators(dominantSpeaker, speaking, reactionType('raised-hand'), publishingVideo, publishingAudio)));
|
|
6065
|
+
const defaultSortPreset = combineComparators(screenSharing, pinned, publishing, ifInvisibleBy(combineComparators(dominantSpeaker, speaking, reactionType('raised-hand'), publishingVideo, publishingAudio)));
|
|
6023
6066
|
/**
|
|
6024
6067
|
* The sorting preset for speaker layout.
|
|
6025
6068
|
*/
|
|
6026
|
-
const speakerLayoutSortPreset = combineComparators(screenSharing, pinned, dominantSpeaker, ifInvisibleBy(combineComparators(speaking, reactionType('raised-hand'), withVideoIngressSource, publishingVideo, publishingAudio)));
|
|
6069
|
+
const speakerLayoutSortPreset = combineComparators(screenSharing, pinned, dominantSpeaker, publishing, ifInvisibleBy(combineComparators(speaking, reactionType('raised-hand'), withVideoIngressSource, publishingVideo, publishingAudio)));
|
|
6027
6070
|
/**
|
|
6028
6071
|
* The sorting preset for layouts that don't render all participants but
|
|
6029
6072
|
* instead, render them in pages.
|
|
@@ -6032,7 +6075,7 @@ const paginatedLayoutSortPreset = combineComparators(pinned, ifInvisibleOrUnknow
|
|
|
6032
6075
|
/**
|
|
6033
6076
|
* The sorting preset for livestreams and audio rooms.
|
|
6034
6077
|
*/
|
|
6035
|
-
const livestreamOrAudioRoomSortPreset = combineComparators(ifInvisibleOrUnknownBy(combineComparators(dominantSpeaker, speaking, reactionType('raised-hand'), withVideoIngressSource, publishingVideo, publishingAudio)), role('admin', 'host', 'speaker'));
|
|
6078
|
+
const livestreamOrAudioRoomSortPreset = combineComparators(publishing, ifInvisibleOrUnknownBy(combineComparators(dominantSpeaker, speaking, reactionType('raised-hand'), withVideoIngressSource, publishingVideo, publishingAudio)), role('admin', 'host', 'speaker'));
|
|
6036
6079
|
|
|
6037
6080
|
/**
|
|
6038
6081
|
* Returns the default egress object - when no egress data is available.
|
|
@@ -18991,11 +19034,11 @@ class StreamClient {
|
|
|
18991
19034
|
return;
|
|
18992
19035
|
// call generic listeners
|
|
18993
19036
|
for (const listener of this.listeners.all || []) {
|
|
18994
|
-
listener
|
|
19037
|
+
invokeEventListener(listener, event, this.logger);
|
|
18995
19038
|
}
|
|
18996
19039
|
// call type specific listeners
|
|
18997
19040
|
for (const listener of this.listeners[event.type] || []) {
|
|
18998
|
-
listener
|
|
19041
|
+
invokeEventListener(listener, event, this.logger);
|
|
18999
19042
|
}
|
|
19000
19043
|
};
|
|
19001
19044
|
/**
|
|
@@ -19015,11 +19058,11 @@ class StreamClient {
|
|
|
19015
19058
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
19016
19059
|
};
|
|
19017
19060
|
getSdkVersion = () => this.options.clientAppIdentifier?.sdkVersion ||
|
|
19018
|
-
"
|
|
19061
|
+
"2.0.0-beta.0";
|
|
19019
19062
|
getUserAgent = () => {
|
|
19020
19063
|
if (!this.cachedUserAgent) {
|
|
19021
19064
|
const { clientAppIdentifier = {} } = this.options;
|
|
19022
|
-
const { sdkName = 'js', sdkVersion = "
|
|
19065
|
+
const { sdkName = 'js', sdkVersion = "2.0.0-beta.0", ...extras } = clientAppIdentifier;
|
|
19023
19066
|
this.cachedUserAgent = [
|
|
19024
19067
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
19025
19068
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|
|
@@ -20805,5 +20848,5 @@ var e2eeWorker$1 = /*#__PURE__*/Object.freeze({
|
|
|
20805
20848
|
e2eeWorker: e2eeWorker
|
|
20806
20849
|
});
|
|
20807
20850
|
|
|
20808
|
-
export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, browsers as Browsers, Call, CallRecordingFailedEventRecordingTypeEnum, CallRecordingReadyEventRecordingTypeEnum, CallRecordingStartedEventRecordingTypeEnum, CallRecordingStoppedEventRecordingTypeEnum, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DEFAULT_LOOPBACK_RECORDING_DURATION_MS, DebounceType, DeviceManager, DeviceManagerState, DynascaleManager, EncryptionManager, EncryptionSettingsRequestModeEnum, EncryptionSettingsResponseModeEnum, ErrorFromResponse, FrameRecordingSettingsRequestModeEnum, FrameRecordingSettingsRequestQualityEnum, FrameRecordingSettingsResponseModeEnum, HLSSettingsRequestQualityTracksEnum, IndividualRecordingSettingsRequestModeEnum, IndividualRecordingSettingsRequestOutputTypesEnum, IndividualRecordingSettingsResponseModeEnum, IngressAudioEncodingOptionsRequestChannelsEnum, IngressSourceRequestFpsEnum, IngressVideoLayerRequestCodecEnum, LOOPBACK_STREAMS_WAIT_TIMEOUT_MS, LayoutSettingsRequestNameEnum, LoopbackStreamsTimeoutError, MAX_LOOPBACK_RECORDING_DURATION_MS, MIN_LOOPBACK_RECORDING_DURATION_MS, MediaStreamRecorder, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RTMPBroadcastRequestQualityEnum, RTMPSettingsRequestQualityEnum, RawRecordingSettingsRequestModeEnum, RawRecordingSettingsResponseModeEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, RequestPermissionRequestPermissionsEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, SfuJoinError, models as SfuModels, SfuTimeoutError, SpeakerManager, SpeakerState, StartClosedCaptionsRequestLanguageEnum, StartTranscriptionRequestLanguageEnum, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestClosedCaptionModeEnum, TranscriptionSettingsRequestLanguageEnum, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseClosedCaptionModeEnum, TranscriptionSettingsResponseLanguageEnum, TranscriptionSettingsResponseModeEnum, TranslationSettingsLanguagesEnum, UpdateUserPermissionsRequestGrantPermissionsEnum, UpdateUserPermissionsRequestRevokePermissionsEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, WSAuthMessageProductsEnum, checkIfAudioOutputChangeSupported, clampLoopbackRecordingDuration, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, enableLoopbackAudio, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getCallMediaEngineProvider, getClientDetails, getDeviceState, getLoopbackStreams, getLoopbackTracks, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio$1 as hasAudio, hasInterruptedTrack, hasPausedTrack, hasScreenShare, hasScreenShareAudio, hasVideo, humanize, isPinned, livestreamOrAudioRoomSortPreset, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, resolveDeviceId, role, screenSharing, setCallMediaEngineProvider, setDeviceInfo, setOSInfo, setPowerState, setSdkInfo, setThermalState, setWebRTCInfo, speakerLayoutSortPreset, speaking, videoLoggerSystem, waitForLoopbackStreams, withLoopbackAudioEnabled, withParticipantSource };
|
|
20851
|
+
export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, browsers as Browsers, Call, CallRecordingFailedEventRecordingTypeEnum, CallRecordingReadyEventRecordingTypeEnum, CallRecordingStartedEventRecordingTypeEnum, CallRecordingStoppedEventRecordingTypeEnum, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DEFAULT_LOOPBACK_RECORDING_DURATION_MS, DebounceType, DeviceManager, DeviceManagerState, DynascaleManager, EncryptionManager, EncryptionSettingsRequestModeEnum, EncryptionSettingsResponseModeEnum, ErrorFromResponse, FrameRecordingSettingsRequestModeEnum, FrameRecordingSettingsRequestQualityEnum, FrameRecordingSettingsResponseModeEnum, HLSSettingsRequestQualityTracksEnum, IndividualRecordingSettingsRequestModeEnum, IndividualRecordingSettingsRequestOutputTypesEnum, IndividualRecordingSettingsResponseModeEnum, IngressAudioEncodingOptionsRequestChannelsEnum, IngressSourceRequestFpsEnum, IngressVideoLayerRequestCodecEnum, LOOPBACK_STREAMS_WAIT_TIMEOUT_MS, LayoutSettingsRequestNameEnum, LoopbackStreamsTimeoutError, MAX_LOOPBACK_RECORDING_DURATION_MS, MIN_LOOPBACK_RECORDING_DURATION_MS, MediaStreamRecorder, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RTMPBroadcastRequestQualityEnum, RTMPSettingsRequestQualityEnum, RawRecordingSettingsRequestModeEnum, RawRecordingSettingsResponseModeEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, RequestPermissionRequestPermissionsEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, SfuJoinError, models as SfuModels, SfuTimeoutError, SpeakerManager, SpeakerState, StartClosedCaptionsRequestLanguageEnum, StartTranscriptionRequestLanguageEnum, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestClosedCaptionModeEnum, TranscriptionSettingsRequestLanguageEnum, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseClosedCaptionModeEnum, TranscriptionSettingsResponseLanguageEnum, TranscriptionSettingsResponseModeEnum, TranslationSettingsLanguagesEnum, UpdateUserPermissionsRequestGrantPermissionsEnum, UpdateUserPermissionsRequestRevokePermissionsEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, WSAuthMessageProductsEnum, checkIfAudioOutputChangeSupported, clampLoopbackRecordingDuration, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, enableLoopbackAudio, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getCallMediaEngineProvider, getClientDetails, getDeviceState, getLoopbackStreams, getLoopbackTracks, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio$1 as hasAudio, hasInterruptedTrack, hasPausedTrack, hasScreenShare, hasScreenShareAudio, hasVideo, humanize, isPinned, livestreamOrAudioRoomSortPreset, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishing, publishingAudio, publishingVideo, reactionType, resolveDeviceId, role, screenSharing, setCallMediaEngineProvider, setDeviceInfo, setOSInfo, setPowerState, setSdkInfo, setThermalState, setWebRTCInfo, speakerLayoutSortPreset, speaking, videoLoggerSystem, waitForLoopbackStreams, withLoopbackAudioEnabled, withParticipantSource };
|
|
20809
20852
|
//# sourceMappingURL=index.es.js.map
|