@stream-io/video-client 1.0.4 → 1.0.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.cjs.js CHANGED
@@ -6846,6 +6846,37 @@ const noopComparator = () => {
6846
6846
  return () => 0;
6847
6847
  };
6848
6848
 
6849
+ /**
6850
+ * Check if a participant has a video.
6851
+ *
6852
+ * @param p the participant to check.
6853
+ */
6854
+ const hasVideo = (p) => p.publishedTracks.includes(TrackType.VIDEO);
6855
+ /**
6856
+ * Check if a participant has audio.
6857
+ *
6858
+ * @param p the participant to check.
6859
+ */
6860
+ const hasAudio = (p) => p.publishedTracks.includes(TrackType.AUDIO);
6861
+ /**
6862
+ * Check if a participant is screen sharing.
6863
+ *
6864
+ * @param p the participant to check.
6865
+ */
6866
+ const hasScreenShare = (p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE);
6867
+ /**
6868
+ * Check if a participant is screen sharing audio.
6869
+ *
6870
+ * @param p the participant to check.
6871
+ */
6872
+ const hasScreenShareAudio = (p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE_AUDIO);
6873
+ /**
6874
+ * Check if the participant is pinned.
6875
+ *
6876
+ * @param p the participant.
6877
+ */
6878
+ const isPinned = (p) => !!p.pin && (p.pin.isLocalPin || p.pin.pinnedAt > 0);
6879
+
6849
6880
  /**
6850
6881
  * A comparator which sorts participants by the fact that they are the dominant speaker or not.
6851
6882
  *
@@ -6976,9 +7007,6 @@ const name = (a, b) => {
6976
7007
  return 0;
6977
7008
  };
6978
7009
  const hasAnyRole = (p, roles) => (p.roles || []).some((r) => roles.includes(r));
6979
- const hasScreenShare = (p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE);
6980
- const hasVideo = (p) => p.publishedTracks.includes(TrackType.VIDEO);
6981
- const hasAudio = (p) => p.publishedTracks.includes(TrackType.AUDIO);
6982
7010
 
6983
7011
  // a comparator decorator which applies the decorated comparator only if the
6984
7012
  // participant is invisible.
@@ -7513,7 +7541,7 @@ class CallState {
7513
7541
  this.remoteParticipants$ = this.participants$.pipe(rxjs.map((participants) => participants.filter((p) => !p.isLocalParticipant)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
7514
7542
  this.pinnedParticipants$ = this.participants$.pipe(rxjs.map((participants) => participants.filter((p) => !!p.pin)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
7515
7543
  this.dominantSpeaker$ = this.participants$.pipe(rxjs.map((participants) => participants.find((p) => p.isDominantSpeaker)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
7516
- this.hasOngoingScreenShare$ = this.participants$.pipe(rxjs.map((participants) => participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE))), rxjs.distinctUntilChanged(), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
7544
+ this.hasOngoingScreenShare$ = this.participants$.pipe(rxjs.map((participants) => participants.some((p) => hasScreenShare(p))), rxjs.distinctUntilChanged(), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
7517
7545
  // dates
7518
7546
  this.createdAt$ = this.createdAtSubject.asObservable();
7519
7547
  this.endedAt$ = this.endedAtSubject.asObservable();
@@ -10383,9 +10411,7 @@ class DynascaleManager {
10383
10411
  const publishedTracksSubscription = boundParticipant.isLocalParticipant
10384
10412
  ? null
10385
10413
  : participant$
10386
- .pipe(rxjs.distinctUntilKeyChanged('publishedTracks'), rxjs.map((p) => p.publishedTracks.includes(trackType === 'videoTrack'
10387
- ? TrackType.VIDEO
10388
- : TrackType.SCREEN_SHARE)), rxjs.distinctUntilChanged())
10414
+ .pipe(rxjs.distinctUntilKeyChanged('publishedTracks'), rxjs.map((p) => trackType === 'videoTrack' ? hasVideo(p) : hasScreenShare(p)), rxjs.distinctUntilChanged())
10389
10415
  .subscribe((isPublishing) => {
10390
10416
  if (isPublishing) {
10391
10417
  // the participant just started to publish a track
@@ -11234,6 +11260,7 @@ class InputMediaDeviceManager {
11234
11260
  resetStatusChangeRequest() {
11235
11261
  this.statusChangePromise = undefined;
11236
11262
  this.statusChangeAbortController = undefined;
11263
+ this.state.setPendingStatus(this.state.status);
11237
11264
  }
11238
11265
  }
11239
11266
 
@@ -12963,7 +12990,7 @@ class Call {
12963
12990
  // NOTE: audio tracks don't have to be requested explicitly
12964
12991
  // as the SFU will implicitly subscribe us to all of them,
12965
12992
  // once they become available.
12966
- if (p.videoDimension && p.publishedTracks.includes(TrackType.VIDEO)) {
12993
+ if (p.videoDimension && hasVideo(p)) {
12967
12994
  subscriptions.push({
12968
12995
  userId: p.userId,
12969
12996
  sessionId: p.sessionId,
@@ -12971,8 +12998,7 @@ class Call {
12971
12998
  dimension: p.videoDimension,
12972
12999
  });
12973
13000
  }
12974
- if (p.screenShareDimension &&
12975
- p.publishedTracks.includes(TrackType.SCREEN_SHARE)) {
13001
+ if (p.screenShareDimension && hasScreenShare(p)) {
12976
13002
  subscriptions.push({
12977
13003
  userId: p.userId,
12978
13004
  sessionId: p.sessionId,
@@ -12980,7 +13006,7 @@ class Call {
12980
13006
  dimension: p.screenShareDimension,
12981
13007
  });
12982
13008
  }
12983
- if (p.publishedTracks.includes(TrackType.SCREEN_SHARE_AUDIO)) {
13009
+ if (hasScreenShareAudio(p)) {
12984
13010
  subscriptions.push({
12985
13011
  userId: p.userId,
12986
13012
  sessionId: p.sessionId,
@@ -15222,7 +15248,7 @@ class StreamClient {
15222
15248
  });
15223
15249
  };
15224
15250
  this.getUserAgent = () => {
15225
- const version = "1.0.4" ;
15251
+ const version = "1.0.6" ;
15226
15252
  return (this.userAgent ||
15227
15253
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
15228
15254
  };
@@ -15760,6 +15786,11 @@ exports.getSdkInfo = getSdkInfo;
15760
15786
  exports.getVideoDevices = getVideoDevices;
15761
15787
  exports.getVideoStream = getVideoStream;
15762
15788
  exports.getWebRTCInfo = getWebRTCInfo;
15789
+ exports.hasAudio = hasAudio;
15790
+ exports.hasScreenShare = hasScreenShare;
15791
+ exports.hasScreenShareAudio = hasScreenShareAudio;
15792
+ exports.hasVideo = hasVideo;
15793
+ exports.isPinned = isPinned;
15763
15794
  exports.livestreamOrAudioRoomSortPreset = livestreamOrAudioRoomSortPreset;
15764
15795
  exports.logLevels = logLevels;
15765
15796
  exports.logToConsole = logToConsole;