livekit-client 1.6.8 → 1.6.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -13940,7 +13940,7 @@ var uaParser = {
13940
13940
  })(uaParser, uaParserExports);
13941
13941
  var UAParser = uaParserExports;
13942
13942
 
13943
- var version$1 = "1.6.8";
13943
+ var version$1 = "1.6.9";
13944
13944
 
13945
13945
  const version = version$1;
13946
13946
  const protocolVersion = 9;
@@ -15000,7 +15000,11 @@ class Track extends eventsExports.EventEmitter {
15000
15000
  element.play().then(() => {
15001
15001
  this.emit(TrackEvent.AudioPlaybackStarted);
15002
15002
  }).catch(e => {
15003
- this.emit(TrackEvent.AudioPlaybackFailed, e);
15003
+ if (e.name === 'NotAllowedError') {
15004
+ this.emit(TrackEvent.AudioPlaybackFailed, e);
15005
+ } else {
15006
+ livekitLogger.warn('could not playback audio', e);
15007
+ }
15004
15008
  // If audio playback isn't allowed make sure we still play back the video
15005
15009
  if (element && allMediaStreamTracks.some(tr => tr.kind === 'video') && e.name === 'NotAllowedError') {
15006
15010
  element.muted = true;
@@ -17669,6 +17673,11 @@ class LocalParticipant extends Participant {
17669
17673
  this.reconnectFuture = undefined;
17670
17674
  this.updateTrackSubscriptionPermissions();
17671
17675
  };
17676
+ this.handleDisconnected = () => {
17677
+ var _a, _b;
17678
+ (_b = (_a = this.reconnectFuture) === null || _a === void 0 ? void 0 : _a.reject) === null || _b === void 0 ? void 0 : _b.call(_a, 'Got disconnected during publishing attempt');
17679
+ this.reconnectFuture = undefined;
17680
+ };
17672
17681
  this.updateTrackSubscriptionPermissions = () => {
17673
17682
  livekitLogger.debug('updating track subscription permissions', {
17674
17683
  allParticipantsAllowed: this.allParticipantsAllowedToSubscribe,
@@ -17847,7 +17856,7 @@ class LocalParticipant extends Participant {
17847
17856
  };
17848
17857
  this.engine.client.onSubscribedQualityUpdate = this.handleSubscribedQualityUpdate;
17849
17858
  this.engine.client.onLocalTrackUnpublished = this.handleLocalTrackUnpublished;
17850
- this.engine.on(EngineEvent.Connected, this.handleReconnected).on(EngineEvent.Restarted, this.handleReconnected).on(EngineEvent.Resumed, this.handleReconnected).on(EngineEvent.Restarting, this.handleReconnecting).on(EngineEvent.Resuming, this.handleReconnecting);
17859
+ this.engine.on(EngineEvent.Connected, this.handleReconnected).on(EngineEvent.Restarted, this.handleReconnected).on(EngineEvent.Resumed, this.handleReconnected).on(EngineEvent.Restarting, this.handleReconnecting).on(EngineEvent.Resuming, this.handleReconnecting).on(EngineEvent.Disconnected, this.handleDisconnected);
17851
17860
  }
17852
17861
  /**
17853
17862
  * Enable or disable a participant's camera track.
@@ -21610,16 +21619,20 @@ class Room extends eventsExports.EventEmitter {
21610
21619
  * @param deviceId
21611
21620
  */
21612
21621
  async switchActiveDevice(kind, deviceId) {
21622
+ let exact = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
21613
21623
  var _a;
21614
21624
  var _b;
21625
+ const deviceConstraint = exact ? {
21626
+ exact: deviceId
21627
+ } : deviceId;
21615
21628
  if (kind === 'audioinput') {
21616
21629
  const prevDeviceId = this.options.audioCaptureDefaults.deviceId;
21617
- this.options.audioCaptureDefaults.deviceId = deviceId;
21630
+ this.options.audioCaptureDefaults.deviceId = deviceConstraint;
21618
21631
  const tracks = Array.from(this.localParticipant.audioTracks.values()).filter(track => track.source === Track.Source.Microphone);
21619
21632
  try {
21620
21633
  await Promise.all(tracks.map(t => {
21621
21634
  var _a;
21622
- return (_a = t.audioTrack) === null || _a === void 0 ? void 0 : _a.setDeviceId(deviceId);
21635
+ return (_a = t.audioTrack) === null || _a === void 0 ? void 0 : _a.setDeviceId(deviceConstraint);
21623
21636
  }));
21624
21637
  } catch (e) {
21625
21638
  this.options.audioCaptureDefaults.deviceId = prevDeviceId;
@@ -21627,12 +21640,12 @@ class Room extends eventsExports.EventEmitter {
21627
21640
  }
21628
21641
  } else if (kind === 'videoinput') {
21629
21642
  const prevDeviceId = this.options.videoCaptureDefaults.deviceId;
21630
- this.options.videoCaptureDefaults.deviceId = deviceId;
21643
+ this.options.videoCaptureDefaults.deviceId = deviceConstraint;
21631
21644
  const tracks = Array.from(this.localParticipant.videoTracks.values()).filter(track => track.source === Track.Source.Camera);
21632
21645
  try {
21633
21646
  await Promise.all(tracks.map(t => {
21634
21647
  var _a;
21635
- return (_a = t.videoTrack) === null || _a === void 0 ? void 0 : _a.setDeviceId(deviceId);
21648
+ return (_a = t.videoTrack) === null || _a === void 0 ? void 0 : _a.setDeviceId(deviceConstraint);
21636
21649
  }));
21637
21650
  } catch (e) {
21638
21651
  this.options.videoCaptureDefaults.deviceId = prevDeviceId;