@stream-io/video-client 0.3.4 → 0.3.6

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
@@ -8023,7 +8023,7 @@ class CallState {
8023
8023
  *
8024
8024
  */
8025
8025
  constructor() {
8026
- this.backstageSubject = new BehaviorSubject(false);
8026
+ this.backstageSubject = new BehaviorSubject(true);
8027
8027
  this.blockedUserIdsSubject = new BehaviorSubject([]);
8028
8028
  this.createdAtSubject = new BehaviorSubject(new Date());
8029
8029
  this.endedAtSubject = new BehaviorSubject(undefined);
@@ -9928,10 +9928,10 @@ class InputMediaDeviceManager {
9928
9928
  */
9929
9929
  disable() {
9930
9930
  return __awaiter(this, void 0, void 0, function* () {
9931
+ this.state.prevStatus = this.state.status;
9931
9932
  if (this.state.status === 'disabled') {
9932
9933
  return;
9933
9934
  }
9934
- this.state.prevStatus = this.state.status;
9935
9935
  yield this.muteStream(this.state.disableMode === 'stop-tracks');
9936
9936
  this.state.setStatus('disabled');
9937
9937
  });
@@ -10555,8 +10555,13 @@ class Call {
10555
10555
  this.state.setCallingState(CallingState.JOINED);
10556
10556
  // React uses a different device management for now
10557
10557
  if (((_h = getSdkInfo()) === null || _h === void 0 ? void 0 : _h.type) !== SdkType.REACT) {
10558
- this.initCamera();
10559
- this.initMic();
10558
+ try {
10559
+ yield this.initCamera();
10560
+ yield this.initMic();
10561
+ }
10562
+ catch (error) {
10563
+ this.logger('warn', 'Camera and/or mic init failed during join call');
10564
+ }
10560
10565
  }
10561
10566
  // 3. once we have the "joinResponse", and possibly reconciled the local state
10562
10567
  // we schedule a fast subscription update for all remote participants
@@ -11289,61 +11294,65 @@ class Call {
11289
11294
  }
11290
11295
  initCamera() {
11291
11296
  var _a, _b, _c;
11292
- if (((_a = this.state.localParticipant) === null || _a === void 0 ? void 0 : _a.videoStream) ||
11293
- !this.permissionsContext.hasPermission('send-video')) {
11294
- return;
11295
- }
11296
- // Set camera direction if it's not yet set
11297
- // This will also start publishing if camera is enabled
11298
- if (!this.camera.state.direction && !this.camera.state.selectedDevice) {
11299
- let defaultDirection = 'front';
11300
- const backendSetting = (_b = this.state.settings) === null || _b === void 0 ? void 0 : _b.video.camera_facing;
11301
- if (backendSetting) {
11302
- defaultDirection = backendSetting === 'front' ? 'front' : 'back';
11297
+ return __awaiter(this, void 0, void 0, function* () {
11298
+ if (((_a = this.state.localParticipant) === null || _a === void 0 ? void 0 : _a.videoStream) ||
11299
+ !this.permissionsContext.hasPermission('send-video')) {
11300
+ return;
11303
11301
  }
11304
- this.camera.selectDirection(defaultDirection);
11305
- }
11306
- else if (this.camera.state.status === 'enabled') {
11307
- // Publish already started media streams (this is the case if there is a lobby screen before join)
11308
- // Wait for media stream
11309
- this.camera.state.mediaStream$
11310
- .pipe(takeWhile((s) => s === undefined, true))
11311
- .subscribe((stream) => {
11312
- var _a;
11313
- if (!((_a = this.state.localParticipant) === null || _a === void 0 ? void 0 : _a.videoStream)) {
11314
- this.publishVideoStream(stream);
11302
+ // Set camera direction if it's not yet set
11303
+ // This will also start publishing if camera is enabled
11304
+ if (!this.camera.state.direction && !this.camera.state.selectedDevice) {
11305
+ let defaultDirection = 'front';
11306
+ const backendSetting = (_b = this.state.settings) === null || _b === void 0 ? void 0 : _b.video.camera_facing;
11307
+ if (backendSetting) {
11308
+ defaultDirection = backendSetting === 'front' ? 'front' : 'back';
11315
11309
  }
11316
- });
11317
- }
11318
- // Apply backend config (this is the case if there is no lobby screen before join)
11319
- if (this.camera.state.status === undefined &&
11320
- ((_c = this.state.settings) === null || _c === void 0 ? void 0 : _c.video.camera_default_on)) {
11321
- void this.camera.enable();
11322
- }
11310
+ this.camera.selectDirection(defaultDirection);
11311
+ }
11312
+ else if (this.camera.state.status === 'enabled') {
11313
+ // Publish already started media streams (this is the case if there is a lobby screen before join)
11314
+ // Wait for media stream
11315
+ this.camera.state.mediaStream$
11316
+ .pipe(takeWhile((s) => s === undefined, true))
11317
+ .subscribe((stream) => {
11318
+ var _a;
11319
+ if (!((_a = this.state.localParticipant) === null || _a === void 0 ? void 0 : _a.videoStream)) {
11320
+ this.publishVideoStream(stream);
11321
+ }
11322
+ });
11323
+ }
11324
+ // Apply backend config (this is the case if there is no lobby screen before join)
11325
+ if (this.camera.state.status === undefined &&
11326
+ ((_c = this.state.settings) === null || _c === void 0 ? void 0 : _c.video.camera_default_on)) {
11327
+ yield this.camera.enable();
11328
+ }
11329
+ });
11323
11330
  }
11324
11331
  initMic() {
11325
11332
  var _a, _b;
11326
- if (((_a = this.state.localParticipant) === null || _a === void 0 ? void 0 : _a.audioStream) ||
11327
- !this.permissionsContext.hasPermission('send-audio')) {
11328
- return;
11329
- }
11330
- // Publish already started media streams (this is the case if there is a lobby screen before join)
11331
- if (this.microphone.state.status === 'enabled') {
11332
- // Wait for media stream
11333
- this.microphone.state.mediaStream$
11334
- .pipe(takeWhile((s) => s === undefined, true))
11335
- .subscribe((stream) => {
11336
- var _a;
11337
- if (!((_a = this.state.localParticipant) === null || _a === void 0 ? void 0 : _a.audioStream)) {
11338
- this.publishAudioStream(stream);
11339
- }
11340
- });
11341
- }
11342
- // Apply backend config (this is the case if there is no lobby screen before join)
11343
- if (this.microphone.state.status === undefined &&
11344
- ((_b = this.state.settings) === null || _b === void 0 ? void 0 : _b.audio.mic_default_on)) {
11345
- void this.microphone.enable();
11346
- }
11333
+ return __awaiter(this, void 0, void 0, function* () {
11334
+ if (((_a = this.state.localParticipant) === null || _a === void 0 ? void 0 : _a.audioStream) ||
11335
+ !this.permissionsContext.hasPermission('send-audio')) {
11336
+ return;
11337
+ }
11338
+ // Publish already started media streams (this is the case if there is a lobby screen before join)
11339
+ if (this.microphone.state.status === 'enabled') {
11340
+ // Wait for media stream
11341
+ this.microphone.state.mediaStream$
11342
+ .pipe(takeWhile((s) => s === undefined, true))
11343
+ .subscribe((stream) => {
11344
+ var _a;
11345
+ if (!((_a = this.state.localParticipant) === null || _a === void 0 ? void 0 : _a.audioStream)) {
11346
+ this.publishAudioStream(stream);
11347
+ }
11348
+ });
11349
+ }
11350
+ // Apply backend config (this is the case if there is no lobby screen before join)
11351
+ if (this.microphone.state.status === undefined &&
11352
+ ((_b = this.state.settings) === null || _b === void 0 ? void 0 : _b.audio.mic_default_on)) {
11353
+ yield this.microphone.enable();
11354
+ }
11355
+ });
11347
11356
  }
11348
11357
  }
11349
11358
 
@@ -12456,7 +12465,7 @@ class WSConnectionFallback {
12456
12465
  }
12457
12466
  }
12458
12467
 
12459
- const version = '0.3.4';
12468
+ const version = '0.3.6';
12460
12469
 
12461
12470
  const logger = getLogger(['location']);
12462
12471
  const HINT_URL = `https://hint.stream-io-video.com/`;