@stream-io/video-client 0.4.0 → 0.4.1

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,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.4.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.4.0...@stream-io/video-client-0.4.1) (2023-10-30)
6
+
7
+
8
+ ### Features
9
+
10
+ * Apply device config settings when call state becomes available ([#1167](https://github.com/GetStream/stream-video-js/issues/1167)) ([38e8ba4](https://github.com/GetStream/stream-video-js/commit/38e8ba459b60d9705af96ad7b9a2a7fa1827ad1e))
11
+
5
12
  ## [0.4.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.3.36...@stream-io/video-client-0.4.0) (2023-10-27)
6
13
 
7
14
 
@@ -10269,6 +10269,7 @@ class InputMediaDeviceManager {
10269
10269
  try {
10270
10270
  await this.enablePromise;
10271
10271
  this.state.setStatus('enabled');
10272
+ this.enablePromise = undefined;
10272
10273
  }
10273
10274
  catch (error) {
10274
10275
  this.enablePromise = undefined;
@@ -11114,6 +11115,7 @@ class Call {
11114
11115
  this.watching = true;
11115
11116
  this.clientStore.registerCall(this);
11116
11117
  }
11118
+ this.applyDeviceConfig();
11117
11119
  return response;
11118
11120
  };
11119
11121
  /**
@@ -11133,6 +11135,7 @@ class Call {
11133
11135
  this.watching = true;
11134
11136
  this.clientStore.registerCall(this);
11135
11137
  }
11138
+ this.applyDeviceConfig();
11136
11139
  return response;
11137
11140
  };
11138
11141
  /**
@@ -11465,8 +11468,8 @@ class Call {
11465
11468
  this.reconnectAttempts = 0; // reset the reconnect attempts counter
11466
11469
  this.state.setCallingState(CallingState.JOINED);
11467
11470
  try {
11468
- await this.initCamera();
11469
- await this.initMic();
11471
+ await this.initCamera({ setStatus: true });
11472
+ await this.initMic({ setStatus: true });
11470
11473
  }
11471
11474
  catch (error) {
11472
11475
  this.logger('warn', 'Camera and/or mic init failed during join call');
@@ -12042,6 +12045,10 @@ class Call {
12042
12045
  this.sendCustomEvent = async (payload) => {
12043
12046
  return this.streamClient.post(`${this.streamClientBasePath}/event`, { custom: payload });
12044
12047
  };
12048
+ this.applyDeviceConfig = () => {
12049
+ this.initCamera({ setStatus: false });
12050
+ this.initMic({ setStatus: false });
12051
+ };
12045
12052
  /**
12046
12053
  * Will begin tracking the given element for visibility changes within the
12047
12054
  * configured viewport element (`call.setViewport`).
@@ -12287,7 +12294,7 @@ class Call {
12287
12294
  get isCreatedByMe() {
12288
12295
  return this.state.createdBy?.id === this.currentUserId;
12289
12296
  }
12290
- async initCamera() {
12297
+ async initCamera(options) {
12291
12298
  // Wait for any in progress camera operation
12292
12299
  if (this.camera.enablePromise) {
12293
12300
  await this.camera.enablePromise;
@@ -12313,19 +12320,21 @@ class Call {
12313
12320
  if (targetResolution) {
12314
12321
  await this.camera.selectTargetResolution(targetResolution);
12315
12322
  }
12316
- // Publish already that was set before we joined
12317
- if (this.camera.state.status === 'enabled' &&
12318
- this.camera.state.mediaStream &&
12319
- !this.publisher?.isPublishing(TrackType.VIDEO)) {
12320
- await this.publishVideoStream(this.camera.state.mediaStream);
12321
- }
12322
- // Start camera if backend config speicifies, and there is no local setting
12323
- if (this.camera.state.status === undefined &&
12324
- this.state.settings?.video.camera_default_on) {
12325
- await this.camera.enable();
12323
+ if (options.setStatus) {
12324
+ // Publish already that was set before we joined
12325
+ if (this.camera.state.status === 'enabled' &&
12326
+ this.camera.state.mediaStream &&
12327
+ !this.publisher?.isPublishing(TrackType.VIDEO)) {
12328
+ await this.publishVideoStream(this.camera.state.mediaStream);
12329
+ }
12330
+ // Start camera if backend config speicifies, and there is no local setting
12331
+ if (this.camera.state.status === undefined &&
12332
+ this.state.settings?.video.camera_default_on) {
12333
+ await this.camera.enable();
12334
+ }
12326
12335
  }
12327
12336
  }
12328
- async initMic() {
12337
+ async initMic(options) {
12329
12338
  // Wait for any in progress mic operation
12330
12339
  if (this.microphone.enablePromise) {
12331
12340
  await this.microphone.enablePromise;
@@ -12337,16 +12346,18 @@ class Call {
12337
12346
  !this.permissionsContext.hasPermission('send-audio')) {
12338
12347
  return;
12339
12348
  }
12340
- // Publish media stream that was set before we joined
12341
- if (this.microphone.state.status === 'enabled' &&
12342
- this.microphone.state.mediaStream &&
12343
- !this.publisher?.isPublishing(TrackType.AUDIO)) {
12344
- await this.publishAudioStream(this.microphone.state.mediaStream);
12345
- }
12346
- // Start mic if backend config specifies, and there is no local setting
12347
- if (this.microphone.state.status === undefined &&
12348
- this.state.settings?.audio.mic_default_on) {
12349
- await this.microphone.enable();
12349
+ if (options.setStatus) {
12350
+ // Publish media stream that was set before we joined
12351
+ if (this.microphone.state.status === 'enabled' &&
12352
+ this.microphone.state.mediaStream &&
12353
+ !this.publisher?.isPublishing(TrackType.AUDIO)) {
12354
+ await this.publishAudioStream(this.microphone.state.mediaStream);
12355
+ }
12356
+ // Start mic if backend config specifies, and there is no local setting
12357
+ if (this.microphone.state.status === undefined &&
12358
+ this.state.settings?.audio.mic_default_on) {
12359
+ await this.microphone.enable();
12360
+ }
12350
12361
  }
12351
12362
  }
12352
12363
  }
@@ -13931,7 +13942,7 @@ class StreamClient {
13931
13942
  });
13932
13943
  };
13933
13944
  this.getUserAgent = () => {
13934
- const version = "0.4.0" ;
13945
+ const version = "0.4.1" ;
13935
13946
  return (this.userAgent ||
13936
13947
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
13937
13948
  };
@@ -14179,6 +14190,7 @@ class StreamVideoClient {
14179
14190
  clientStore: this.writeableStateStore,
14180
14191
  });
14181
14192
  call.state.updateFromCallResponse(c.call);
14193
+ call.applyDeviceConfig();
14182
14194
  if (data.watch) {
14183
14195
  this.writeableStateStore.registerCall(call);
14184
14196
  }