@stream-io/video-client 1.0.7 → 1.0.9

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 CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [1.0.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.0.8...@stream-io/video-client-1.0.9) (2024-05-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * prevent double sound detectors set up ([#1371](https://github.com/GetStream/stream-video-js/issues/1371)) ([51c9198](https://github.com/GetStream/stream-video-js/commit/51c9198a96b956884554bc508e38c90af0cee30f))
11
+
12
+ ### [1.0.8](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.0.7...@stream-io/video-client-1.0.8) (2024-05-23)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * call.reject when there is no participant and call is in joined state ([#1366](https://github.com/GetStream/stream-video-js/issues/1366)) ([308d045](https://github.com/GetStream/stream-video-js/commit/308d0452303743922ca1e982bd271b42857d96b3))
18
+
5
19
  ### [1.0.7](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.0.6...@stream-io/video-client-1.0.7) (2024-05-21)
6
20
 
7
21
 
@@ -11904,39 +11904,43 @@ class MicrophoneManager extends InputMediaDeviceManager {
11904
11904
  return this.call.stopPublish(TrackType.AUDIO, stopTracks);
11905
11905
  }
11906
11906
  async startSpeakingWhileMutedDetection(deviceId) {
11907
- await this.stopSpeakingWhileMutedDetection();
11908
- if (isReactNative()) {
11909
- this.rnSpeechDetector = new RNSpeechDetector();
11910
- await this.rnSpeechDetector.start();
11911
- const unsubscribe = this.rnSpeechDetector?.onSpeakingDetectedStateChange((event) => {
11912
- this.state.setSpeakingWhileMuted(event.isSoundDetected);
11913
- });
11914
- this.soundDetectorCleanup = () => {
11915
- unsubscribe();
11916
- this.rnSpeechDetector?.stop();
11917
- this.rnSpeechDetector = undefined;
11918
- };
11919
- }
11920
- else {
11921
- // Need to start a new stream that's not connected to publisher
11922
- const stream = await this.getStream({
11923
- deviceId,
11924
- });
11925
- this.soundDetectorCleanup = createSoundDetector(stream, (event) => {
11926
- this.state.setSpeakingWhileMuted(event.isSoundDetected);
11927
- });
11928
- }
11907
+ const startPromise = (async () => {
11908
+ await this.stopSpeakingWhileMutedDetection();
11909
+ if (isReactNative()) {
11910
+ this.rnSpeechDetector = new RNSpeechDetector();
11911
+ await this.rnSpeechDetector.start();
11912
+ const unsubscribe = this.rnSpeechDetector?.onSpeakingDetectedStateChange((event) => {
11913
+ this.state.setSpeakingWhileMuted(event.isSoundDetected);
11914
+ });
11915
+ return () => {
11916
+ unsubscribe();
11917
+ this.rnSpeechDetector?.stop();
11918
+ this.rnSpeechDetector = undefined;
11919
+ };
11920
+ }
11921
+ else {
11922
+ // Need to start a new stream that's not connected to publisher
11923
+ const stream = await this.getStream({
11924
+ deviceId,
11925
+ });
11926
+ return createSoundDetector(stream, (event) => {
11927
+ this.state.setSpeakingWhileMuted(event.isSoundDetected);
11928
+ });
11929
+ }
11930
+ })();
11931
+ this.soundDetectorCleanup = async () => {
11932
+ const cleanup = await startPromise;
11933
+ await cleanup();
11934
+ };
11935
+ await startPromise;
11929
11936
  }
11930
11937
  async stopSpeakingWhileMutedDetection() {
11931
11938
  if (!this.soundDetectorCleanup)
11932
11939
  return;
11940
+ const soundDetectorCleanup = this.soundDetectorCleanup;
11941
+ this.soundDetectorCleanup = undefined;
11933
11942
  this.state.setSpeakingWhileMuted(false);
11934
- try {
11935
- await this.soundDetectorCleanup();
11936
- }
11937
- finally {
11938
- this.soundDetectorCleanup = undefined;
11939
- }
11943
+ await soundDetectorCleanup();
11940
11944
  }
11941
11945
  }
11942
11946
 
@@ -12313,7 +12317,9 @@ class Call {
12313
12317
  if (this.ringing) {
12314
12318
  // I'm the one who started the call, so I should cancel it.
12315
12319
  const hasOtherParticipants = this.state.remoteParticipants.length > 0;
12316
- if (this.isCreatedByMe && !hasOtherParticipants) {
12320
+ if (this.isCreatedByMe &&
12321
+ !hasOtherParticipants &&
12322
+ callingState === CallingState.RINGING) {
12317
12323
  // Signals other users that I have cancelled my call to them
12318
12324
  // before they accepted it.
12319
12325
  await this.reject();
@@ -15263,7 +15269,7 @@ class StreamClient {
15263
15269
  });
15264
15270
  };
15265
15271
  this.getUserAgent = () => {
15266
- const version = "1.0.7" ;
15272
+ const version = "1.0.9" ;
15267
15273
  return (this.userAgent ||
15268
15274
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
15269
15275
  };