@stream-io/video-client 0.3.36 → 0.4.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/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [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
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * **react-sdk:** Universal Device Management API (#1127)
11
+
12
+ ### Features
13
+
14
+ * **react-sdk:** Universal Device Management API ([#1127](https://github.com/GetStream/stream-video-js/issues/1127)) ([aeb3561](https://github.com/GetStream/stream-video-js/commit/aeb35612745f45254b536281c5f81d1bcac2bab5))
15
+
5
16
  ### [0.3.36](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.3.35...@stream-io/video-client-0.3.36) (2023-10-25)
6
17
 
7
18
 
@@ -5736,9 +5736,6 @@ var DebounceType;
5736
5736
  DebounceType[DebounceType["MEDIUM"] = 600] = "MEDIUM";
5737
5737
  DebounceType[DebounceType["SLOW"] = 1200] = "SLOW";
5738
5738
  })(DebounceType || (DebounceType = {}));
5739
- const isStreamVideoLocalParticipant = (p) => {
5740
- return !!p.isLocalParticipant;
5741
- };
5742
5739
 
5743
5740
  /**
5744
5741
  * @generated from protobuf service stream.video.sfu.signal.SignalServer
@@ -6222,21 +6219,6 @@ const trackTypeToParticipantStreamKey = (trackType) => {
6222
6219
  throw new Error(`Unknown track type: ${exhaustiveTrackTypeCheck}`);
6223
6220
  }
6224
6221
  };
6225
- const trackTypeToDeviceIdKey = (trackType) => {
6226
- switch (trackType) {
6227
- case TrackType.AUDIO:
6228
- return 'audioDeviceId';
6229
- case TrackType.VIDEO:
6230
- return 'videoDeviceId';
6231
- case TrackType.SCREEN_SHARE:
6232
- case TrackType.SCREEN_SHARE_AUDIO:
6233
- case TrackType.UNSPECIFIED:
6234
- return undefined;
6235
- default:
6236
- const exhaustiveTrackTypeCheck = trackType;
6237
- throw new Error(`Unknown track type: ${exhaustiveTrackTypeCheck}`);
6238
- }
6239
- };
6240
6222
  const muteTypeToTrackType = (muteType) => {
6241
6223
  switch (muteType) {
6242
6224
  case 'audio':
@@ -6628,14 +6610,11 @@ class Publisher {
6628
6610
  }));
6629
6611
  }
6630
6612
  else {
6631
- const deviceId = track.getSettings().deviceId;
6632
- const audioOrVideoDeviceKey = trackTypeToDeviceIdKey(trackType);
6633
6613
  this.state.updateParticipant(this.sfuClient.sessionId, (p) => {
6634
6614
  return {
6635
6615
  publishedTracks: p.publishedTracks.includes(trackType)
6636
6616
  ? p.publishedTracks
6637
6617
  : [...p.publishedTracks, trackType],
6638
- ...(audioOrVideoDeviceKey && { [audioOrVideoDeviceKey]: deviceId }),
6639
6618
  [audioOrVideoOrScreenShareStream]: mediaStream,
6640
6619
  };
6641
6620
  });
@@ -8477,7 +8456,7 @@ class CallState {
8477
8456
  // maintain stable-sort by mutating the participants stored
8478
8457
  // in the original subject
8479
8458
  map$1((ps) => ps.sort(this.sortParticipantsBy)), shareReplay({ bufferSize: 1, refCount: true }));
8480
- this.localParticipant$ = this.participants$.pipe(map$1((participants) => participants.find(isStreamVideoLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
8459
+ this.localParticipant$ = this.participants$.pipe(map$1((participants) => participants.find((p) => p.isLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
8481
8460
  this.remoteParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !p.isLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
8482
8461
  this.pinnedParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !!p.pin)), shareReplay({ bufferSize: 1, refCount: true }));
8483
8462
  this.dominantSpeaker$ = this.participants$.pipe(map$1((participants) => participants.find((p) => p.isDominantSpeaker)), shareReplay({ bufferSize: 1, refCount: true }));
@@ -9212,14 +9191,7 @@ const reconcileParticipantLocalState = (target, source) => {
9212
9191
  if (!source)
9213
9192
  return target;
9214
9193
  // copy everything from source to target
9215
- Object.assign(target, source);
9216
- if (isStreamVideoLocalParticipant(source) &&
9217
- isStreamVideoLocalParticipant(target)) {
9218
- target.audioDeviceId = source.audioDeviceId;
9219
- target.videoDeviceId = source.videoDeviceId;
9220
- target.audioOutputDeviceId = source.audioOutputDeviceId;
9221
- }
9222
- return target;
9194
+ return Object.assign(target, source);
9223
9195
  };
9224
9196
 
9225
9197
  /**
@@ -9822,24 +9794,20 @@ class DynascaleManager {
9822
9794
  }
9823
9795
  });
9824
9796
  });
9825
- const sinkIdSubscription = combineLatest([
9826
- this.call.state.localParticipant$,
9827
- this.call.speaker.state.selectedDevice$,
9828
- ]).subscribe(([p, selectedDevice]) => {
9829
- const deviceId = getSdkInfo()?.type === SdkType.REACT
9830
- ? p?.audioOutputDeviceId
9831
- : selectedDevice;
9832
- if ('setSinkId' in audioElement && typeof deviceId === 'string') {
9833
- // @ts-expect-error setSinkId is not yet in the lib
9834
- audioElement.setSinkId(deviceId);
9835
- }
9836
- });
9797
+ const sinkIdSubscription = !('setSinkId' in audioElement)
9798
+ ? null
9799
+ : this.call.speaker.state.selectedDevice$.subscribe((deviceId) => {
9800
+ if (deviceId) {
9801
+ // @ts-expect-error setSinkId is not yet in the lib
9802
+ audioElement.setSinkId(deviceId);
9803
+ }
9804
+ });
9837
9805
  const volumeSubscription = this.call.speaker.state.volume$.subscribe((volume) => {
9838
9806
  audioElement.volume = volume;
9839
9807
  });
9840
9808
  audioElement.autoplay = true;
9841
9809
  return () => {
9842
- sinkIdSubscription.unsubscribe();
9810
+ sinkIdSubscription?.unsubscribe();
9843
9811
  volumeSubscription.unsubscribe();
9844
9812
  updateMediaStreamSubscription.unsubscribe();
9845
9813
  };
@@ -9888,11 +9856,12 @@ class PermissionsContext {
9888
9856
  * within the call.
9889
9857
  *
9890
9858
  * @param permission the permission to check for.
9859
+ * @param settings the call settings to check against (optional).
9891
9860
  */
9892
- this.canRequest = (permission) => {
9893
- if (!this.settings)
9861
+ this.canRequest = (permission, settings = this.settings) => {
9862
+ if (!settings)
9894
9863
  return false;
9895
- const { audio, video, screensharing } = this.settings;
9864
+ const { audio, video, screensharing } = settings;
9896
9865
  switch (permission) {
9897
9866
  case OwnCapability.SEND_AUDIO:
9898
9867
  return audio.access_request_enabled;
@@ -11495,15 +11464,12 @@ class Call {
11495
11464
  this.state.setServerSidePins(pins);
11496
11465
  this.reconnectAttempts = 0; // reset the reconnect attempts counter
11497
11466
  this.state.setCallingState(CallingState.JOINED);
11498
- // React uses a different device management for now
11499
- if (getSdkInfo()?.type !== SdkType.REACT) {
11500
- try {
11501
- await this.initCamera();
11502
- await this.initMic();
11503
- }
11504
- catch (error) {
11505
- this.logger('warn', 'Camera and/or mic init failed during join call');
11506
- }
11467
+ try {
11468
+ await this.initCamera();
11469
+ await this.initMic();
11470
+ }
11471
+ catch (error) {
11472
+ this.logger('warn', 'Camera and/or mic init failed during join call');
11507
11473
  }
11508
11474
  // 3. once we have the "joinResponse", and possibly reconciled the local state
11509
11475
  // we schedule a fast subscription update for all remote participants
@@ -11730,56 +11696,6 @@ class Call {
11730
11696
  this.stopReportingStatsFor = (sessionId) => {
11731
11697
  return this.statsReporter?.stopReportingStatsFor(sessionId);
11732
11698
  };
11733
- /**
11734
- * Sets the used audio output device (`audioOutputDeviceId` of the [`localParticipant$`](./StreamVideoClient.md/#readonlystatestore).
11735
- *
11736
- * This method only stores the selection, if you're using custom UI components, you'll have to implement the audio switching, for more information see: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/sinkId.
11737
- *
11738
- *
11739
- * @param deviceId the selected device, `undefined` means the user wants to use the system's default audio output
11740
- *
11741
- * @deprecated use `call.speaker` instead
11742
- */
11743
- this.setAudioOutputDevice = (deviceId) => {
11744
- if (!this.sfuClient)
11745
- return;
11746
- this.state.updateParticipant(this.sfuClient.sessionId, {
11747
- audioOutputDeviceId: deviceId,
11748
- });
11749
- };
11750
- /**
11751
- * Sets the `audioDeviceId` property of the [`localParticipant$`](./StreamVideoClient.md/#readonlystatestore)).
11752
- *
11753
- * This method only stores the selection, if you want to start publishing a media stream call the [`publishAudioStream` method](#publishaudiostream) that will set `audioDeviceId` as well.
11754
- *
11755
- *
11756
- * @param deviceId the selected device, pass `undefined` to clear the device selection
11757
- *
11758
- * @deprecated use call.microphone.select
11759
- */
11760
- this.setAudioDevice = (deviceId) => {
11761
- if (!this.sfuClient)
11762
- return;
11763
- this.state.updateParticipant(this.sfuClient.sessionId, {
11764
- audioDeviceId: deviceId,
11765
- });
11766
- };
11767
- /**
11768
- * Sets the `videoDeviceId` property of the [`localParticipant$`](./StreamVideoClient.md/#readonlystatestore).
11769
- *
11770
- * This method only stores the selection, if you want to start publishing a media stream call the [`publishVideoStream` method](#publishvideostream) that will set `videoDeviceId` as well.
11771
- *
11772
- * @param deviceId the selected device, pass `undefined` to clear the device selection
11773
- *
11774
- * @deprecated use call.camera.select
11775
- */
11776
- this.setVideoDevice = (deviceId) => {
11777
- if (!this.sfuClient)
11778
- return;
11779
- this.state.updateParticipant(this.sfuClient.sessionId, {
11780
- videoDeviceId: deviceId,
11781
- });
11782
- };
11783
11699
  /**
11784
11700
  * Resets the last sent reaction for the user holding the given `sessionId`. This is a local action, it won't reset the reaction on the backend.
11785
11701
  *
@@ -14015,7 +13931,7 @@ class StreamClient {
14015
13931
  });
14016
13932
  };
14017
13933
  this.getUserAgent = () => {
14018
- const version = "0.3.36" ;
13934
+ const version = "0.4.0" ;
14019
13935
  return (this.userAgent ||
14020
13936
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14021
13937
  };
@@ -14549,5 +14465,5 @@ class StreamVideoServerClient extends StreamVideoClient {
14549
14465
  }
14550
14466
  }
14551
14467
 
14552
- export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsNameEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
14468
+ export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsNameEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
14553
14469
  //# sourceMappingURL=index.browser.es.js.map