@stream-io/video-client 1.44.2 → 1.44.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 +14 -0
- package/dist/index.browser.es.js +34 -33
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +34 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +34 -33
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamSfuClient.d.ts +1 -0
- package/dist/src/devices/BrowserPermission.d.ts +2 -0
- package/dist/src/devices/CameraManagerState.d.ts +2 -1
- package/dist/src/devices/MicrophoneManagerState.d.ts +2 -1
- package/dist/src/devices/devices.d.ts +2 -2
- package/package.json +2 -2
- package/src/StreamSfuClient.ts +15 -9
- package/src/devices/BrowserPermission.ts +5 -0
- package/src/devices/CameraManager.ts +6 -1
- package/src/devices/CameraManagerState.ts +3 -2
- package/src/devices/MicrophoneManager.ts +1 -2
- package/src/devices/MicrophoneManagerState.ts +3 -2
- package/src/devices/devices.ts +25 -31
- package/src/rpc/retryable.ts +2 -0
package/dist/index.es.js
CHANGED
|
@@ -4006,6 +4006,8 @@ const retryable = async (rpc, signal, maxRetries = Number.POSITIVE_INFINITY) =>
|
|
|
4006
4006
|
do {
|
|
4007
4007
|
if (attempt > 0)
|
|
4008
4008
|
await sleep(retryInterval(attempt));
|
|
4009
|
+
if (signal?.aborted)
|
|
4010
|
+
throw new Error(signal.reason);
|
|
4009
4011
|
try {
|
|
4010
4012
|
result = await rpc({ attempt });
|
|
4011
4013
|
}
|
|
@@ -6282,7 +6284,7 @@ const getSdkVersion = (sdk) => {
|
|
|
6282
6284
|
return sdk ? `${sdk.major}.${sdk.minor}.${sdk.patch}` : '0.0.0-development';
|
|
6283
6285
|
};
|
|
6284
6286
|
|
|
6285
|
-
const version = "1.44.
|
|
6287
|
+
const version = "1.44.4";
|
|
6286
6288
|
const [major, minor, patch] = version.split('.');
|
|
6287
6289
|
let sdkInfo = {
|
|
6288
6290
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -8583,6 +8585,7 @@ class StreamSfuClient {
|
|
|
8583
8585
|
this.isClosingClean = false;
|
|
8584
8586
|
this.pingIntervalInMs = 5 * 1000;
|
|
8585
8587
|
this.unhealthyTimeoutInMs = 15 * 1000;
|
|
8588
|
+
this.subscriptionsConcurrencyTag = Symbol('subscriptionsConcurrencyTag');
|
|
8586
8589
|
/**
|
|
8587
8590
|
* Promise that resolves when the JoinResponse is received.
|
|
8588
8591
|
* Rejects after a certain threshold if the response is not received.
|
|
@@ -8690,8 +8693,10 @@ class StreamSfuClient {
|
|
|
8690
8693
|
this.close(StreamSfuClient.NORMAL_CLOSURE, reason.substring(0, 115));
|
|
8691
8694
|
};
|
|
8692
8695
|
this.updateSubscriptions = async (tracks) => {
|
|
8693
|
-
|
|
8694
|
-
|
|
8696
|
+
return withoutConcurrency(this.subscriptionsConcurrencyTag, async () => {
|
|
8697
|
+
await this.joinTask;
|
|
8698
|
+
return retryable((invocationMeta) => this.rpc.updateSubscriptions({ sessionId: this.sessionId, tracks }, { invocationMeta }), this.abortController.signal);
|
|
8699
|
+
});
|
|
8695
8700
|
};
|
|
8696
8701
|
this.setPublisher = async (data) => {
|
|
8697
8702
|
await this.joinTask;
|
|
@@ -10294,6 +10299,9 @@ class BrowserPermission {
|
|
|
10294
10299
|
}
|
|
10295
10300
|
setState(state) {
|
|
10296
10301
|
if (this.state !== state) {
|
|
10302
|
+
const { tracer, queryName } = this.permission;
|
|
10303
|
+
const traceKey = `navigator.mediaDevices.${queryName}.permission`;
|
|
10304
|
+
tracer?.trace(traceKey, { previous: this.state, state });
|
|
10297
10305
|
this.state = state;
|
|
10298
10306
|
this.listeners.forEach((listener) => listener(state));
|
|
10299
10307
|
}
|
|
@@ -10364,17 +10372,19 @@ const videoDeviceConstraints = {
|
|
|
10364
10372
|
* Keeps track of the browser permission to use microphone. This permission also
|
|
10365
10373
|
* affects an ability to enumerate audio devices.
|
|
10366
10374
|
*/
|
|
10367
|
-
const getAudioBrowserPermission = lazy(() => new BrowserPermission({
|
|
10375
|
+
const getAudioBrowserPermission = lazy((tracer) => new BrowserPermission({
|
|
10368
10376
|
constraints: audioDeviceConstraints,
|
|
10369
10377
|
queryName: 'microphone',
|
|
10378
|
+
tracer,
|
|
10370
10379
|
}));
|
|
10371
10380
|
/**
|
|
10372
10381
|
* Keeps track of the browser permission to use camera. This permission also
|
|
10373
10382
|
* affects an ability to enumerate video devices.
|
|
10374
10383
|
*/
|
|
10375
|
-
const getVideoBrowserPermission = lazy(() => new BrowserPermission({
|
|
10384
|
+
const getVideoBrowserPermission = lazy((tracer) => new BrowserPermission({
|
|
10376
10385
|
constraints: videoDeviceConstraints,
|
|
10377
10386
|
queryName: 'camera',
|
|
10387
|
+
tracer,
|
|
10378
10388
|
}));
|
|
10379
10389
|
const getDeviceChangeObserver = lazy((tracer) => {
|
|
10380
10390
|
// 'addEventListener' is not available in React Native, returning
|
|
@@ -10390,7 +10400,7 @@ const getDeviceChangeObserver = lazy((tracer) => {
|
|
|
10390
10400
|
* the observable errors.
|
|
10391
10401
|
*/
|
|
10392
10402
|
const getAudioDevices = lazy((tracer) => {
|
|
10393
|
-
return merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission().asObservable()).pipe(startWith([]), concatMap(() => getDevices(getAudioBrowserPermission(), 'audioinput', tracer)), shareReplay(1));
|
|
10403
|
+
return merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission(tracer).asObservable()).pipe(startWith([]), concatMap(() => getDevices(getAudioBrowserPermission(tracer), 'audioinput', tracer)), shareReplay(1));
|
|
10394
10404
|
});
|
|
10395
10405
|
/**
|
|
10396
10406
|
* Prompts the user for a permission to use video devices (if not already granted
|
|
@@ -10399,7 +10409,7 @@ const getAudioDevices = lazy((tracer) => {
|
|
|
10399
10409
|
* the observable errors.
|
|
10400
10410
|
*/
|
|
10401
10411
|
const getVideoDevices = lazy((tracer) => {
|
|
10402
|
-
return merge(getDeviceChangeObserver(tracer), getVideoBrowserPermission().asObservable()).pipe(startWith([]), concatMap(() => getDevices(getVideoBrowserPermission(), 'videoinput', tracer)), shareReplay(1));
|
|
10412
|
+
return merge(getDeviceChangeObserver(tracer), getVideoBrowserPermission(tracer).asObservable()).pipe(startWith([]), concatMap(() => getDevices(getVideoBrowserPermission(tracer), 'videoinput', tracer)), shareReplay(1));
|
|
10403
10413
|
});
|
|
10404
10414
|
/**
|
|
10405
10415
|
* Prompts the user for a permission to use video devices (if not already granted
|
|
@@ -10408,7 +10418,7 @@ const getVideoDevices = lazy((tracer) => {
|
|
|
10408
10418
|
* the observable errors.
|
|
10409
10419
|
*/
|
|
10410
10420
|
const getAudioOutputDevices = lazy((tracer) => {
|
|
10411
|
-
return merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission().asObservable()).pipe(startWith([]), concatMap(() => getDevices(getAudioBrowserPermission(), 'audiooutput', tracer)), shareReplay(1));
|
|
10421
|
+
return merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission(tracer).asObservable()).pipe(startWith([]), concatMap(() => getDevices(getAudioBrowserPermission(tracer), 'audiooutput', tracer)), shareReplay(1));
|
|
10412
10422
|
});
|
|
10413
10423
|
let getUserMediaExecId = 0;
|
|
10414
10424
|
const getStream = async (constraints, tracer) => {
|
|
@@ -10474,25 +10484,21 @@ const getAudioStream = async (trackConstraints, tracer) => {
|
|
|
10474
10484
|
},
|
|
10475
10485
|
};
|
|
10476
10486
|
try {
|
|
10477
|
-
await getAudioBrowserPermission().prompt({
|
|
10487
|
+
await getAudioBrowserPermission(tracer).prompt({
|
|
10478
10488
|
throwOnNotAllowed: true,
|
|
10479
10489
|
forcePrompt: true,
|
|
10480
10490
|
});
|
|
10481
10491
|
return await getStream(constraints, tracer);
|
|
10482
10492
|
}
|
|
10483
10493
|
catch (error) {
|
|
10494
|
+
const logger = videoLoggerSystem.getLogger('devices');
|
|
10484
10495
|
if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
|
|
10485
10496
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10486
10497
|
const { deviceId, ...relaxedConstraints } = trackConstraints;
|
|
10487
|
-
|
|
10488
|
-
.getLogger('devices')
|
|
10489
|
-
.warn('Failed to get audio stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
|
|
10498
|
+
logger.warn('Failed to get audio stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
|
|
10490
10499
|
return getAudioStream(relaxedConstraints, tracer);
|
|
10491
10500
|
}
|
|
10492
|
-
|
|
10493
|
-
error,
|
|
10494
|
-
constraints,
|
|
10495
|
-
});
|
|
10501
|
+
logger.error('Failed to get audio stream', { error, constraints });
|
|
10496
10502
|
throw error;
|
|
10497
10503
|
}
|
|
10498
10504
|
};
|
|
@@ -10512,25 +10518,21 @@ const getVideoStream = async (trackConstraints, tracer) => {
|
|
|
10512
10518
|
},
|
|
10513
10519
|
};
|
|
10514
10520
|
try {
|
|
10515
|
-
await getVideoBrowserPermission().prompt({
|
|
10521
|
+
await getVideoBrowserPermission(tracer).prompt({
|
|
10516
10522
|
throwOnNotAllowed: true,
|
|
10517
10523
|
forcePrompt: true,
|
|
10518
10524
|
});
|
|
10519
10525
|
return await getStream(constraints, tracer);
|
|
10520
10526
|
}
|
|
10521
10527
|
catch (error) {
|
|
10528
|
+
const logger = videoLoggerSystem.getLogger('devices');
|
|
10522
10529
|
if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
|
|
10523
10530
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10524
10531
|
const { deviceId, ...relaxedConstraints } = trackConstraints;
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
.warn('Failed to get video stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
|
|
10528
|
-
return getVideoStream(relaxedConstraints);
|
|
10532
|
+
logger.warn('Failed to get video stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
|
|
10533
|
+
return getVideoStream(relaxedConstraints, tracer);
|
|
10529
10534
|
}
|
|
10530
|
-
|
|
10531
|
-
error,
|
|
10532
|
-
constraints,
|
|
10533
|
-
});
|
|
10535
|
+
logger.error('Failed to get video stream', { error, constraints });
|
|
10534
10536
|
throw error;
|
|
10535
10537
|
}
|
|
10536
10538
|
};
|
|
@@ -11301,8 +11303,8 @@ class DeviceManagerState {
|
|
|
11301
11303
|
}
|
|
11302
11304
|
|
|
11303
11305
|
class CameraManagerState extends DeviceManagerState {
|
|
11304
|
-
constructor() {
|
|
11305
|
-
super('stop-tracks', getVideoBrowserPermission());
|
|
11306
|
+
constructor(tracer) {
|
|
11307
|
+
super('stop-tracks', getVideoBrowserPermission(tracer));
|
|
11306
11308
|
this.directionSubject = new BehaviorSubject(undefined);
|
|
11307
11309
|
/**
|
|
11308
11310
|
* Observable that emits the preferred camera direction
|
|
@@ -11356,7 +11358,7 @@ class CameraManager extends DeviceManager {
|
|
|
11356
11358
|
* @param devicePersistence the device persistence preferences to use.
|
|
11357
11359
|
*/
|
|
11358
11360
|
constructor(call, devicePersistence) {
|
|
11359
|
-
super(call, new CameraManagerState(), TrackType.VIDEO, devicePersistence);
|
|
11361
|
+
super(call, new CameraManagerState(call.tracer), TrackType.VIDEO, devicePersistence);
|
|
11360
11362
|
this.targetResolution = {
|
|
11361
11363
|
width: 1280,
|
|
11362
11364
|
height: 720,
|
|
@@ -11567,8 +11569,8 @@ class AudioDeviceManagerState extends DeviceManagerState {
|
|
|
11567
11569
|
}
|
|
11568
11570
|
|
|
11569
11571
|
class MicrophoneManagerState extends AudioDeviceManagerState {
|
|
11570
|
-
constructor(disableMode) {
|
|
11571
|
-
super(disableMode, getAudioBrowserPermission(), AudioBitrateProfile.VOICE_STANDARD_UNSPECIFIED);
|
|
11572
|
+
constructor(disableMode, tracer) {
|
|
11573
|
+
super(disableMode, getAudioBrowserPermission(tracer), AudioBitrateProfile.VOICE_STANDARD_UNSPECIFIED);
|
|
11572
11574
|
this.speakingWhileMutedSubject = new BehaviorSubject(false);
|
|
11573
11575
|
/**
|
|
11574
11576
|
* An Observable that emits `true` if the user's microphone is muted, but they're speaking.
|
|
@@ -11908,7 +11910,7 @@ class RNSpeechDetector {
|
|
|
11908
11910
|
|
|
11909
11911
|
class MicrophoneManager extends AudioDeviceManager {
|
|
11910
11912
|
constructor(call, devicePersistence, disableMode = 'stop-tracks') {
|
|
11911
|
-
super(call, new MicrophoneManagerState(disableMode), TrackType.AUDIO, devicePersistence);
|
|
11913
|
+
super(call, new MicrophoneManagerState(disableMode, call.tracer), TrackType.AUDIO, devicePersistence);
|
|
11912
11914
|
this.speakingWhileMutedNotificationEnabled = true;
|
|
11913
11915
|
this.soundDetectorConcurrencyTag = Symbol('soundDetectorConcurrencyTag');
|
|
11914
11916
|
this.silenceThresholdMs = 5000;
|
|
@@ -12010,7 +12012,6 @@ class MicrophoneManager extends AudioDeviceManager {
|
|
|
12010
12012
|
deviceId,
|
|
12011
12013
|
label,
|
|
12012
12014
|
};
|
|
12013
|
-
console.log(event);
|
|
12014
12015
|
this.call.tracer.trace('mic.capture_report', event);
|
|
12015
12016
|
this.call.streamClient.dispatchEvent(event);
|
|
12016
12017
|
},
|
|
@@ -15884,7 +15885,7 @@ class StreamClient {
|
|
|
15884
15885
|
this.getUserAgent = () => {
|
|
15885
15886
|
if (!this.cachedUserAgent) {
|
|
15886
15887
|
const { clientAppIdentifier = {} } = this.options;
|
|
15887
|
-
const { sdkName = 'js', sdkVersion = "1.44.
|
|
15888
|
+
const { sdkName = 'js', sdkVersion = "1.44.4", ...extras } = clientAppIdentifier;
|
|
15888
15889
|
this.cachedUserAgent = [
|
|
15889
15890
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
15890
15891
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|