@stream-io/video-client 1.4.3 → 1.4.5

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/dist/index.es.js CHANGED
@@ -926,6 +926,14 @@ var SdkType;
926
926
  * @generated from protobuf enum value: SDK_TYPE_UNITY = 7;
927
927
  */
928
928
  SdkType[SdkType["UNITY"] = 7] = "UNITY";
929
+ /**
930
+ * @generated from protobuf enum value: SDK_TYPE_GO = 8;
931
+ */
932
+ SdkType[SdkType["GO"] = 8] = "GO";
933
+ /**
934
+ * @generated from protobuf enum value: SDK_TYPE_PLAIN_JAVASCRIPT = 9;
935
+ */
936
+ SdkType[SdkType["PLAIN_JAVASCRIPT"] = 9] = "PLAIN_JAVASCRIPT";
929
937
  })(SdkType || (SdkType = {}));
930
938
  /**
931
939
  * @generated from protobuf enum stream.video.sfu.models.TrackUnpublishReason
@@ -6528,7 +6536,14 @@ function getIceCandidate(candidate) {
6528
6536
  }
6529
6537
  }
6530
6538
 
6531
- let sdkInfo;
6539
+ const version = "1.4.5" ;
6540
+ const [major, minor, patch] = version.split('.');
6541
+ let sdkInfo = {
6542
+ type: SdkType.PLAIN_JAVASCRIPT,
6543
+ major,
6544
+ minor,
6545
+ patch,
6546
+ };
6532
6547
  let osInfo;
6533
6548
  let deviceInfo;
6534
6549
  let webRtcInfo;
@@ -11165,6 +11180,7 @@ class InputMediaDeviceManager {
11165
11180
  this.isTrackStoppedDueToTrackEnd = false;
11166
11181
  this.filters = [];
11167
11182
  this.statusChangeConcurrencyTag = Symbol('statusChangeConcurrencyTag');
11183
+ this.filterRegistrationConcurrencyTag = Symbol('filterRegistrationConcurrencyTag');
11168
11184
  /**
11169
11185
  * Disposes the manager.
11170
11186
  *
@@ -11267,14 +11283,24 @@ class InputMediaDeviceManager {
11267
11283
  * a new stream with the applied filter.
11268
11284
  *
11269
11285
  * @param filter the filter to register.
11270
- * @returns a function that will unregister the filter.
11286
+ * @returns MediaStreamFilterRegistrationResult
11271
11287
  */
11272
- async registerFilter(filter) {
11273
- this.filters.push(filter);
11274
- await this.applySettingsToStream();
11275
- return async () => {
11276
- this.filters = this.filters.filter((f) => f !== filter);
11288
+ registerFilter(filter) {
11289
+ const entry = {
11290
+ start: filter,
11291
+ stop: undefined,
11292
+ };
11293
+ const registered = withoutConcurrency(this.filterRegistrationConcurrencyTag, async () => {
11294
+ this.filters.push(entry);
11277
11295
  await this.applySettingsToStream();
11296
+ });
11297
+ return {
11298
+ registered,
11299
+ unregister: () => withoutConcurrency(this.filterRegistrationConcurrencyTag, async () => {
11300
+ entry.stop?.();
11301
+ this.filters = this.filters.filter((f) => f !== entry);
11302
+ await this.applySettingsToStream();
11303
+ }),
11278
11304
  };
11279
11305
  }
11280
11306
  /**
@@ -11327,6 +11353,7 @@ class InputMediaDeviceManager {
11327
11353
  this.state.mediaStream.release();
11328
11354
  }
11329
11355
  this.state.setMediaStream(undefined, undefined);
11356
+ this.filters.forEach((entry) => entry.stop?.());
11330
11357
  }
11331
11358
  }
11332
11359
  muteTracks() {
@@ -11431,7 +11458,16 @@ class InputMediaDeviceManager {
11431
11458
  // e.g. camera or microphone stream
11432
11459
  rootStream = this.getStream(constraints);
11433
11460
  // we publish the last MediaStream of the chain
11434
- stream = await this.filters.reduce((parent, filter) => parent.then(filter).then(chainWith(parent)), rootStream);
11461
+ stream = await this.filters.reduce((parent, entry) => parent
11462
+ .then((inputStream) => {
11463
+ const { stop, output } = entry.start(inputStream);
11464
+ entry.stop = stop;
11465
+ return output;
11466
+ })
11467
+ .then(chainWith(parent), (error) => {
11468
+ this.logger('warn', 'Fitler failed to start and will be ignored', error);
11469
+ return parent;
11470
+ }), rootStream);
11435
11471
  }
11436
11472
  if (this.call.state.callingState === CallingState.JOINED) {
11437
11473
  await this.publishStream(stream);
@@ -12036,7 +12072,9 @@ class MicrophoneManager extends InputMediaDeviceManager {
12036
12072
  });
12037
12073
  }
12038
12074
  });
12039
- this.noiseCancellationRegistration = this.registerFilter(noiseCancellation.toFilter());
12075
+ const registrationResult = this.registerFilter(noiseCancellation.toFilter());
12076
+ this.noiseCancellationRegistration = registrationResult.registered;
12077
+ this.uregisterNoiseCancellation = registrationResult.unregister;
12040
12078
  await this.noiseCancellationRegistration;
12041
12079
  // handles an edge case where a noise cancellation is enabled after
12042
12080
  // the participant as joined the call -> we immediately enable NC
@@ -12062,8 +12100,7 @@ class MicrophoneManager extends InputMediaDeviceManager {
12062
12100
  if (isReactNative()) {
12063
12101
  throw new Error('Noise cancellation is not supported in React Native');
12064
12102
  }
12065
- await this.noiseCancellationRegistration
12066
- ?.then((unregister) => unregister())
12103
+ await (this.uregisterNoiseCancellation?.() ?? Promise.resolve())
12067
12104
  .then(() => this.noiseCancellation?.disable())
12068
12105
  .then(() => this.noiseCancellationChangeUnsubscribe?.())
12069
12106
  .catch((err) => {
@@ -15483,7 +15520,7 @@ class StreamClient {
15483
15520
  });
15484
15521
  };
15485
15522
  this.getUserAgent = () => {
15486
- const version = "1.4.3" ;
15523
+ const version = "1.4.5" ;
15487
15524
  return (this.userAgent ||
15488
15525
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
15489
15526
  };