@stream-io/video-client 1.25.5 → 1.26.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/dist/index.cjs.js CHANGED
@@ -5812,7 +5812,7 @@ const aggregate = (stats) => {
5812
5812
  return report;
5813
5813
  };
5814
5814
 
5815
- const version = "1.25.5";
5815
+ const version = "1.26.0";
5816
5816
  const [major, minor, patch] = version.split('.');
5817
5817
  let sdkInfo = {
5818
5818
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -10537,20 +10537,26 @@ const createSoundDetector = (audioStream, onSoundDetectedStateChanged, options =
10537
10537
  };
10538
10538
 
10539
10539
  class RNSpeechDetector {
10540
- constructor() {
10540
+ constructor(externalAudioStream) {
10541
10541
  this.pc1 = new RTCPeerConnection({});
10542
10542
  this.pc2 = new RTCPeerConnection({});
10543
+ this.externalAudioStream = externalAudioStream;
10543
10544
  }
10544
10545
  /**
10545
10546
  * Starts the speech detection.
10546
10547
  */
10547
10548
  async start(onSoundDetectedStateChanged) {
10548
10549
  try {
10549
- this.cleanupAudioStream();
10550
- const audioStream = await navigator.mediaDevices.getUserMedia({
10551
- audio: true,
10552
- });
10553
- this.audioStream = audioStream;
10550
+ let audioStream;
10551
+ if (this.externalAudioStream != null) {
10552
+ audioStream = this.externalAudioStream;
10553
+ }
10554
+ else {
10555
+ audioStream = await navigator.mediaDevices.getUserMedia({
10556
+ audio: true,
10557
+ });
10558
+ this.audioStream = audioStream;
10559
+ }
10554
10560
  this.pc1.addEventListener('icecandidate', async (e) => {
10555
10561
  await this.pc2.addIceCandidate(e.candidate);
10556
10562
  });
@@ -10592,7 +10598,12 @@ class RNSpeechDetector {
10592
10598
  stop() {
10593
10599
  this.pc1.close();
10594
10600
  this.pc2.close();
10595
- this.cleanupAudioStream();
10601
+ if (this.externalAudioStream != null) {
10602
+ this.externalAudioStream = undefined;
10603
+ }
10604
+ else {
10605
+ this.cleanupAudioStream();
10606
+ }
10596
10607
  }
10597
10608
  /**
10598
10609
  * Public method that detects the audio levels and returns the status.
@@ -14284,7 +14295,7 @@ class StreamClient {
14284
14295
  this.getUserAgent = () => {
14285
14296
  if (!this.cachedUserAgent) {
14286
14297
  const { clientAppIdentifier = {} } = this.options;
14287
- const { sdkName = 'js', sdkVersion = "1.25.5", ...extras } = clientAppIdentifier;
14298
+ const { sdkName = 'js', sdkVersion = "1.26.0", ...extras } = clientAppIdentifier;
14288
14299
  this.cachedUserAgent = [
14289
14300
  `stream-video-${sdkName}-v${sdkVersion}`,
14290
14301
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
@@ -14863,6 +14874,7 @@ exports.MicrophoneManager = MicrophoneManager;
14863
14874
  exports.MicrophoneManagerState = MicrophoneManagerState;
14864
14875
  exports.NoiseCancellationSettingsModeEnum = NoiseCancellationSettingsModeEnum;
14865
14876
  exports.OwnCapability = OwnCapability;
14877
+ exports.RNSpeechDetector = RNSpeechDetector;
14866
14878
  exports.RTMPBroadcastRequestQualityEnum = RTMPBroadcastRequestQualityEnum;
14867
14879
  exports.RTMPSettingsRequestQualityEnum = RTMPSettingsRequestQualityEnum;
14868
14880
  exports.RecordSettingsRequestModeEnum = RecordSettingsRequestModeEnum;