@stream-io/video-client 1.29.0 → 1.30.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.
@@ -1,5 +1,5 @@
1
1
  import { MessageType } from '@protobuf-ts/runtime';
2
- import { CallEndedReason, CallGrants, CallState, ClientCapability, ClientDetails, Codec, ConnectionQuality, Error as Error$, GoAwayReason, ICETrickle as ICETrickle$, Participant, ParticipantCount, PeerType, Pin, PublishOption, SubscribeOption, TrackInfo, TrackType, TrackUnpublishReason, WebsocketReconnectStrategy } from '../models/models';
2
+ import { CallEndedReason, CallGrants, CallState, ClientCapability, ClientDetails, Codec, ConnectionQuality, Error as Error$, GoAwayReason, ICETrickle as ICETrickle$, Participant, ParticipantCount, ParticipantSource, PeerType, Pin, PublishOption, SubscribeOption, TrackInfo, TrackType, TrackUnpublishReason, WebsocketReconnectStrategy } from '../models/models';
3
3
  import { TrackSubscriptionDetails } from '../signal_rpc/signal';
4
4
  /**
5
5
  * SFUEvent is a message that is sent from the SFU to the client.
@@ -472,6 +472,10 @@ export interface JoinRequest {
472
472
  * @generated from protobuf field: repeated stream.video.sfu.models.ClientCapability capabilities = 11;
473
473
  */
474
474
  capabilities: ClientCapability[];
475
+ /**
476
+ * @generated from protobuf field: stream.video.sfu.models.ParticipantSource source = 12;
477
+ */
478
+ source: ParticipantSource;
475
479
  }
476
480
  /**
477
481
  * @generated from protobuf message stream.video.sfu.event.ReconnectDetails
@@ -133,6 +133,10 @@ export interface Participant {
133
133
  * @generated from protobuf field: repeated string roles = 13;
134
134
  */
135
135
  roles: string[];
136
+ /**
137
+ * @generated from protobuf field: stream.video.sfu.models.ParticipantSource source = 14;
138
+ */
139
+ source: ParticipantSource;
136
140
  }
137
141
  /**
138
142
  * @generated from protobuf message stream.video.sfu.models.StreamQuality
@@ -755,6 +759,37 @@ export declare enum TrackType {
755
759
  */
756
760
  SCREEN_SHARE_AUDIO = 4
757
761
  }
762
+ /**
763
+ * must be aligned with kit
764
+ *
765
+ * @generated from protobuf enum stream.video.sfu.models.ParticipantSource
766
+ */
767
+ export declare enum ParticipantSource {
768
+ /**
769
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_WEBRTC_UNSPECIFIED = 0;
770
+ */
771
+ WEBRTC_UNSPECIFIED = 0,
772
+ /**
773
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_RTMP = 1;
774
+ */
775
+ RTMP = 1,
776
+ /**
777
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_WHIP = 2;
778
+ */
779
+ WHIP = 2,
780
+ /**
781
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_SIP = 3;
782
+ */
783
+ SIP = 3,
784
+ /**
785
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_RTSP = 4;
786
+ */
787
+ RTSP = 4,
788
+ /**
789
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_SRT = 5;
790
+ */
791
+ SRT = 5
792
+ }
758
793
  /**
759
794
  * @generated from protobuf enum stream.video.sfu.models.ErrorCode
760
795
  */
@@ -1,5 +1,6 @@
1
1
  import { Comparator } from './';
2
2
  import { StreamVideoParticipant } from '../types';
3
+ import { ParticipantSource } from '../gen/video/sfu/models/models';
3
4
  /**
4
5
  * A comparator which sorts participants by the fact that they are the dominant speaker or not.
5
6
  *
@@ -42,6 +43,13 @@ export declare const publishingAudio: Comparator<StreamVideoParticipant>;
42
43
  * @param b the second participant.
43
44
  */
44
45
  export declare const pinned: Comparator<StreamVideoParticipant>;
46
+ /**
47
+ * A comparator creator which will set up a comparator which prioritizes
48
+ * participants who are from a specific source (e.g., WebRTC, RTMP, WHIP...).
49
+ *
50
+ * @param source the source to prioritize.
51
+ */
52
+ export declare const withParticipantSource: (source: ParticipantSource) => Comparator<StreamVideoParticipant>;
45
53
  /**
46
54
  * A comparator creator which will set up a comparator which prioritizes
47
55
  * participants who have a specific reaction.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "browser": "dist/index.browser.es.js",
package/src/Call.ts CHANGED
@@ -112,6 +112,7 @@ import {
112
112
  ClientCapability,
113
113
  ClientDetails,
114
114
  Codec,
115
+ ParticipantSource,
115
116
  PublishOption,
116
117
  SubscribeOption,
117
118
  TrackType,
@@ -1015,6 +1016,7 @@ export class Call {
1015
1016
  preferredPublishOptions,
1016
1017
  preferredSubscribeOptions,
1017
1018
  capabilities: Array.from(this.clientCapabilities),
1019
+ source: ParticipantSource.WEBRTC_UNSPECIFIED,
1018
1020
  });
1019
1021
 
1020
1022
  this.currentPublishOptions = publishOptions;
@@ -25,7 +25,7 @@ const tokenProvider = (userId: string) => {
25
25
  };
26
26
  };
27
27
 
28
- describe('StreamVideoClient - coordinator API', () => {
28
+ describe.skip('StreamVideoClient - coordinator API', () => {
29
29
  let client: StreamVideoClient;
30
30
  const user = {
31
31
  id: 'sara',
@@ -15,6 +15,7 @@ import {
15
15
  ICETrickle as ICETrickle$,
16
16
  Participant,
17
17
  ParticipantCount,
18
+ ParticipantSource,
18
19
  PeerType,
19
20
  Pin,
20
21
  PublishOption,
@@ -522,6 +523,10 @@ export interface JoinRequest {
522
523
  * @generated from protobuf field: repeated stream.video.sfu.models.ClientCapability capabilities = 11;
523
524
  */
524
525
  capabilities: ClientCapability[];
526
+ /**
527
+ * @generated from protobuf field: stream.video.sfu.models.ParticipantSource source = 12;
528
+ */
529
+ source: ParticipantSource;
525
530
  }
526
531
  /**
527
532
  * @generated from protobuf message stream.video.sfu.event.ReconnectDetails
@@ -1404,6 +1409,16 @@ class JoinRequest$Type extends MessageType<JoinRequest> {
1404
1409
  'CLIENT_CAPABILITY_',
1405
1410
  ],
1406
1411
  },
1412
+ {
1413
+ no: 12,
1414
+ name: 'source',
1415
+ kind: 'enum',
1416
+ T: () => [
1417
+ 'stream.video.sfu.models.ParticipantSource',
1418
+ ParticipantSource,
1419
+ 'PARTICIPANT_SOURCE_',
1420
+ ],
1421
+ },
1407
1422
  ]);
1408
1423
  }
1409
1424
  }
@@ -137,6 +137,10 @@ export interface Participant {
137
137
  * @generated from protobuf field: repeated string roles = 13;
138
138
  */
139
139
  roles: string[];
140
+ /**
141
+ * @generated from protobuf field: stream.video.sfu.models.ParticipantSource source = 14;
142
+ */
143
+ source: ParticipantSource;
140
144
  }
141
145
  /**
142
146
  * @generated from protobuf message stream.video.sfu.models.StreamQuality
@@ -759,6 +763,37 @@ export enum TrackType {
759
763
  */
760
764
  SCREEN_SHARE_AUDIO = 4,
761
765
  }
766
+ /**
767
+ * must be aligned with kit
768
+ *
769
+ * @generated from protobuf enum stream.video.sfu.models.ParticipantSource
770
+ */
771
+ export enum ParticipantSource {
772
+ /**
773
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_WEBRTC_UNSPECIFIED = 0;
774
+ */
775
+ WEBRTC_UNSPECIFIED = 0,
776
+ /**
777
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_RTMP = 1;
778
+ */
779
+ RTMP = 1,
780
+ /**
781
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_WHIP = 2;
782
+ */
783
+ WHIP = 2,
784
+ /**
785
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_SIP = 3;
786
+ */
787
+ SIP = 3,
788
+ /**
789
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_RTSP = 4;
790
+ */
791
+ RTSP = 4,
792
+ /**
793
+ * @generated from protobuf enum value: PARTICIPANT_SOURCE_SRT = 5;
794
+ */
795
+ SRT = 5,
796
+ }
762
797
  /**
763
798
  * @generated from protobuf enum stream.video.sfu.models.ErrorCode
764
799
  */
@@ -1211,6 +1246,16 @@ class Participant$Type extends MessageType<Participant> {
1211
1246
  repeat: 2 /*RepeatType.UNPACKED*/,
1212
1247
  T: 9 /*ScalarType.STRING*/,
1213
1248
  },
1249
+ {
1250
+ no: 14,
1251
+ name: 'source',
1252
+ kind: 'enum',
1253
+ T: () => [
1254
+ 'stream.video.sfu.models.ParticipantSource',
1255
+ ParticipantSource,
1256
+ 'PARTICIPANT_SOURCE_',
1257
+ ],
1258
+ },
1214
1259
  ]);
1215
1260
  }
1216
1261
  }
@@ -1,5 +1,6 @@
1
1
  import { Comparator } from './';
2
2
  import { StreamVideoParticipant } from '../types';
3
+ import { ParticipantSource } from '../gen/video/sfu/models/models';
3
4
  import {
4
5
  hasAudio,
5
6
  hasScreenShare,
@@ -86,6 +87,20 @@ export const pinned: Comparator<StreamVideoParticipant> = (a, b) => {
86
87
  return 0;
87
88
  };
88
89
 
90
+ /**
91
+ * A comparator creator which will set up a comparator which prioritizes
92
+ * participants who are from a specific source (e.g., WebRTC, RTMP, WHIP...).
93
+ *
94
+ * @param source the source to prioritize.
95
+ */
96
+ export const withParticipantSource =
97
+ (source: ParticipantSource): Comparator<StreamVideoParticipant> =>
98
+ (a, b) => {
99
+ if (a.source === source && b.source !== source) return -1;
100
+ if (a.source !== source && b.source === source) return 1;
101
+ return 0;
102
+ };
103
+
89
104
  /**
90
105
  * A comparator creator which will set up a comparator which prioritizes
91
106
  * participants who have a specific reaction.
@@ -1,3 +1,4 @@
1
+ import { ParticipantSource } from '../gen/video/sfu/models/models';
1
2
  import { StreamVideoParticipant, VisibilityState } from '../types';
2
3
  import { combineComparators, conditional } from './comparator';
3
4
  import {
@@ -9,6 +10,7 @@ import {
9
10
  role,
10
11
  screenSharing,
11
12
  speaking,
13
+ withParticipantSource,
12
14
  } from './participants';
13
15
 
14
16
  // a comparator decorator which applies the decorated comparator only if the
@@ -48,7 +50,6 @@ export const defaultSortPreset = combineComparators(
48
50
  publishingAudio,
49
51
  ),
50
52
  ),
51
- // ifInvisibleBy(name),
52
53
  );
53
54
 
54
55
  /**
@@ -66,7 +67,6 @@ export const speakerLayoutSortPreset = combineComparators(
66
67
  publishingAudio,
67
68
  ),
68
69
  ),
69
- // ifInvisibleBy(name),
70
70
  );
71
71
 
72
72
  /**
@@ -84,7 +84,6 @@ export const paginatedLayoutSortPreset = combineComparators(
84
84
  publishingAudio,
85
85
  ),
86
86
  ),
87
- // ifInvisibleOrUnknownBy(name),
88
87
  );
89
88
 
90
89
  /**
@@ -96,10 +95,10 @@ export const livestreamOrAudioRoomSortPreset = combineComparators(
96
95
  dominantSpeaker,
97
96
  speaking,
98
97
  reactionType('raised-hand'),
98
+ withParticipantSource(ParticipantSource.RTMP),
99
99
  publishingVideo,
100
100
  publishingAudio,
101
101
  ),
102
102
  ),
103
103
  role('admin', 'host', 'speaker'),
104
- // name,
105
104
  );