@stream-io/video-client 1.12.3 → 1.13.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 +18 -0
- package/dist/index.browser.es.js +116 -33
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +118 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +116 -33
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +4 -0
- package/dist/src/client-details.d.ts +11 -0
- package/package.json +4 -4
- package/src/Call.ts +40 -30
- package/src/client-details.ts +80 -0
- package/src/helpers/DynascaleManager.ts +19 -5
- package/src/stats/SfuStatsReporter.ts +6 -2
package/dist/index.es.js
CHANGED
|
@@ -3300,7 +3300,7 @@ const retryable = async (rpc, signal) => {
|
|
|
3300
3300
|
return result;
|
|
3301
3301
|
};
|
|
3302
3302
|
|
|
3303
|
-
const version = "1.
|
|
3303
|
+
const version = "1.13.0";
|
|
3304
3304
|
const [major, minor, patch] = version.split('.');
|
|
3305
3305
|
let sdkInfo = {
|
|
3306
3306
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -3311,6 +3311,7 @@ let sdkInfo = {
|
|
|
3311
3311
|
let osInfo;
|
|
3312
3312
|
let deviceInfo;
|
|
3313
3313
|
let webRtcInfo;
|
|
3314
|
+
let deviceState;
|
|
3314
3315
|
const setSdkInfo = (info) => {
|
|
3315
3316
|
sdkInfo = info;
|
|
3316
3317
|
};
|
|
@@ -3335,6 +3336,67 @@ const getWebRTCInfo = () => {
|
|
|
3335
3336
|
const setWebRTCInfo = (info) => {
|
|
3336
3337
|
webRtcInfo = info;
|
|
3337
3338
|
};
|
|
3339
|
+
const setThermalState = (state) => {
|
|
3340
|
+
if (!osInfo) {
|
|
3341
|
+
deviceState = { oneofKind: undefined };
|
|
3342
|
+
return;
|
|
3343
|
+
}
|
|
3344
|
+
if (osInfo.name === 'android') {
|
|
3345
|
+
const thermalState = AndroidThermalState[state] ||
|
|
3346
|
+
AndroidThermalState.UNSPECIFIED;
|
|
3347
|
+
deviceState = {
|
|
3348
|
+
oneofKind: 'android',
|
|
3349
|
+
android: {
|
|
3350
|
+
thermalState,
|
|
3351
|
+
isPowerSaverMode: deviceState?.oneofKind === 'android' &&
|
|
3352
|
+
deviceState.android.isPowerSaverMode,
|
|
3353
|
+
},
|
|
3354
|
+
};
|
|
3355
|
+
}
|
|
3356
|
+
if (osInfo.name.toLowerCase() === 'ios') {
|
|
3357
|
+
const thermalState = AppleThermalState[state] ||
|
|
3358
|
+
AppleThermalState.UNSPECIFIED;
|
|
3359
|
+
deviceState = {
|
|
3360
|
+
oneofKind: 'apple',
|
|
3361
|
+
apple: {
|
|
3362
|
+
thermalState,
|
|
3363
|
+
isLowPowerModeEnabled: deviceState?.oneofKind === 'apple' &&
|
|
3364
|
+
deviceState.apple.isLowPowerModeEnabled,
|
|
3365
|
+
},
|
|
3366
|
+
};
|
|
3367
|
+
}
|
|
3368
|
+
};
|
|
3369
|
+
const setPowerState = (powerMode) => {
|
|
3370
|
+
if (!osInfo) {
|
|
3371
|
+
deviceState = { oneofKind: undefined };
|
|
3372
|
+
return;
|
|
3373
|
+
}
|
|
3374
|
+
if (osInfo.name === 'android') {
|
|
3375
|
+
deviceState = {
|
|
3376
|
+
oneofKind: 'android',
|
|
3377
|
+
android: {
|
|
3378
|
+
thermalState: deviceState?.oneofKind === 'android'
|
|
3379
|
+
? deviceState.android.thermalState
|
|
3380
|
+
: AndroidThermalState.UNSPECIFIED,
|
|
3381
|
+
isPowerSaverMode: powerMode,
|
|
3382
|
+
},
|
|
3383
|
+
};
|
|
3384
|
+
}
|
|
3385
|
+
if (osInfo.name.toLowerCase() === 'ios') {
|
|
3386
|
+
deviceState = {
|
|
3387
|
+
oneofKind: 'apple',
|
|
3388
|
+
apple: {
|
|
3389
|
+
thermalState: deviceState?.oneofKind === 'apple'
|
|
3390
|
+
? deviceState.apple.thermalState
|
|
3391
|
+
: AppleThermalState.UNSPECIFIED,
|
|
3392
|
+
isLowPowerModeEnabled: powerMode,
|
|
3393
|
+
},
|
|
3394
|
+
};
|
|
3395
|
+
}
|
|
3396
|
+
};
|
|
3397
|
+
const getDeviceState = () => {
|
|
3398
|
+
return deviceState;
|
|
3399
|
+
};
|
|
3338
3400
|
const getClientDetails = () => {
|
|
3339
3401
|
if (isReactNative()) {
|
|
3340
3402
|
// Since RN doesn't support web, sharing browser info is not required
|
|
@@ -7626,7 +7688,7 @@ class SfuStatsReporter {
|
|
|
7626
7688
|
publisherStats,
|
|
7627
7689
|
audioDevices: this.inputDevices.get('mic'),
|
|
7628
7690
|
videoDevices: this.inputDevices.get('camera'),
|
|
7629
|
-
deviceState:
|
|
7691
|
+
deviceState: getDeviceState(),
|
|
7630
7692
|
telemetry: telemetryData,
|
|
7631
7693
|
});
|
|
7632
7694
|
};
|
|
@@ -7956,17 +8018,27 @@ class DynascaleManager {
|
|
|
7956
8018
|
const resizeObserver = boundParticipant.isLocalParticipant
|
|
7957
8019
|
? null
|
|
7958
8020
|
: new ResizeObserver(() => {
|
|
7959
|
-
const currentDimensions =
|
|
8021
|
+
const currentDimensions = {
|
|
8022
|
+
width: videoElement.clientWidth,
|
|
8023
|
+
height: videoElement.clientHeight,
|
|
8024
|
+
};
|
|
7960
8025
|
// skip initial trigger
|
|
7961
8026
|
if (!lastDimensions) {
|
|
7962
8027
|
lastDimensions = currentDimensions;
|
|
7963
8028
|
return;
|
|
7964
8029
|
}
|
|
7965
|
-
if (lastDimensions === currentDimensions
|
|
8030
|
+
if ((lastDimensions.width === currentDimensions.width &&
|
|
8031
|
+
lastDimensions.height === currentDimensions.height) ||
|
|
7966
8032
|
viewportVisibilityState === VisibilityState.INVISIBLE) {
|
|
7967
8033
|
return;
|
|
7968
8034
|
}
|
|
7969
|
-
|
|
8035
|
+
const relativeDelta = Math.max(currentDimensions.width / lastDimensions.width, currentDimensions.height / lastDimensions.height);
|
|
8036
|
+
// Low quality video in an upscaled video element is very noticable.
|
|
8037
|
+
// We try to upscale faster, and downscale slower. We also update debounce
|
|
8038
|
+
// more if the size change is not significant, gurading against fast-firing
|
|
8039
|
+
// resize events.
|
|
8040
|
+
const debounceType = relativeDelta > 1.2 ? DebounceType.IMMEDIATE : DebounceType.MEDIUM;
|
|
8041
|
+
requestTrackWithDimensions(debounceType, {
|
|
7970
8042
|
width: videoElement.clientWidth,
|
|
7971
8043
|
height: videoElement.clientHeight,
|
|
7972
8044
|
});
|
|
@@ -7982,7 +8054,7 @@ class DynascaleManager {
|
|
|
7982
8054
|
.subscribe((isPublishing) => {
|
|
7983
8055
|
if (isPublishing) {
|
|
7984
8056
|
// the participant just started to publish a track
|
|
7985
|
-
requestTrackWithDimensions(DebounceType.
|
|
8057
|
+
requestTrackWithDimensions(DebounceType.IMMEDIATE, {
|
|
7986
8058
|
width: videoElement.clientWidth,
|
|
7987
8059
|
height: videoElement.clientHeight,
|
|
7988
8060
|
});
|
|
@@ -11262,26 +11334,35 @@ class Call {
|
|
|
11262
11334
|
* Applicable only for ringing calls.
|
|
11263
11335
|
*/
|
|
11264
11336
|
this.scheduleAutoDrop = () => {
|
|
11265
|
-
|
|
11266
|
-
this.
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11337
|
+
this.cancelAutoDrop();
|
|
11338
|
+
const settings = this.state.settings;
|
|
11339
|
+
if (!settings)
|
|
11340
|
+
return;
|
|
11341
|
+
// ignore if the call is not ringing
|
|
11342
|
+
if (this.state.callingState !== CallingState.RINGING)
|
|
11343
|
+
return;
|
|
11344
|
+
const timeoutInMs = this.isCreatedByMe
|
|
11345
|
+
? settings.ring.auto_cancel_timeout_ms
|
|
11346
|
+
: settings.ring.incoming_call_timeout_ms;
|
|
11347
|
+
// 0 means no auto-drop
|
|
11348
|
+
if (timeoutInMs <= 0)
|
|
11349
|
+
return;
|
|
11350
|
+
this.dropTimeout = setTimeout(() => {
|
|
11351
|
+
// the call might have stopped ringing by this point,
|
|
11352
|
+
// e.g. it was already accepted and joined
|
|
11270
11353
|
if (this.state.callingState !== CallingState.RINGING)
|
|
11271
11354
|
return;
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
}, timeoutInMs);
|
|
11284
|
-
}));
|
|
11355
|
+
this.leave({ reject: true, reason: 'timeout' }).catch((err) => {
|
|
11356
|
+
this.logger('error', 'Failed to drop call', err);
|
|
11357
|
+
});
|
|
11358
|
+
}, timeoutInMs);
|
|
11359
|
+
};
|
|
11360
|
+
/**
|
|
11361
|
+
* Cancels a scheduled auto-drop timeout.
|
|
11362
|
+
*/
|
|
11363
|
+
this.cancelAutoDrop = () => {
|
|
11364
|
+
clearTimeout(this.dropTimeout);
|
|
11365
|
+
this.dropTimeout = undefined;
|
|
11285
11366
|
};
|
|
11286
11367
|
/**
|
|
11287
11368
|
* Retrieves the list of recordings for the current call or call session.
|
|
@@ -11617,15 +11698,17 @@ class Call {
|
|
|
11617
11698
|
}
|
|
11618
11699
|
}));
|
|
11619
11700
|
this.leaveCallHooks.add(
|
|
11620
|
-
//
|
|
11621
|
-
createSubscription(this.state.
|
|
11701
|
+
// cancel auto-drop when call is
|
|
11702
|
+
createSubscription(this.state.session$, (session) => {
|
|
11622
11703
|
if (!this.ringing)
|
|
11623
11704
|
return;
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11705
|
+
const receiverId = this.clientStore.connectedUser?.id;
|
|
11706
|
+
if (!receiverId)
|
|
11707
|
+
return;
|
|
11708
|
+
const isAcceptedByMe = Boolean(session?.accepted_by[receiverId]);
|
|
11709
|
+
const isRejectedByMe = Boolean(session?.rejected_by[receiverId]);
|
|
11710
|
+
if (isAcceptedByMe || isRejectedByMe) {
|
|
11711
|
+
this.cancelAutoDrop();
|
|
11629
11712
|
}
|
|
11630
11713
|
}));
|
|
11631
11714
|
this.leaveCallHooks.add(
|
|
@@ -12810,7 +12893,7 @@ class StreamClient {
|
|
|
12810
12893
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
12811
12894
|
};
|
|
12812
12895
|
this.getUserAgent = () => {
|
|
12813
|
-
const version = "1.
|
|
12896
|
+
const version = "1.13.0";
|
|
12814
12897
|
return (this.userAgent ||
|
|
12815
12898
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
12816
12899
|
};
|
|
@@ -13319,5 +13402,5 @@ class StreamVideoClient {
|
|
|
13319
13402
|
}
|
|
13320
13403
|
StreamVideoClient._instanceMap = new Map();
|
|
13321
13404
|
|
|
13322
|
-
export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, BlockListOptionsBehaviorEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, ChannelConfigWithInfoAutomodBehaviorEnum, ChannelConfigWithInfoAutomodEnum, ChannelConfigWithInfoBlocklistBehaviorEnum, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseModeEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogLevel, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio, hasScreenShare, hasScreenShareAudio, hasVideo, isPinned, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, setWebRTCInfo, speakerLayoutSortPreset, speaking };
|
|
13405
|
+
export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, BlockListOptionsBehaviorEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, ChannelConfigWithInfoAutomodBehaviorEnum, ChannelConfigWithInfoAutomodEnum, ChannelConfigWithInfoBlocklistBehaviorEnum, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseModeEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getDeviceState, getLogLevel, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio, hasScreenShare, hasScreenShareAudio, hasVideo, isPinned, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setPowerState, setSdkInfo, setThermalState, setWebRTCInfo, speakerLayoutSortPreset, speaking };
|
|
13323
13406
|
//# sourceMappingURL=index.es.js.map
|