@stream-io/video-client 0.8.0 → 1.0.1

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,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [1.0.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.0.0...@stream-io/video-client-1.0.1) (2024-05-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **state:** handle participantUpdated event ([#1341](https://github.com/GetStream/stream-video-js/issues/1341)) ([96cb99f](https://github.com/GetStream/stream-video-js/commit/96cb99fe2b661e3f4899a7c16b4159cad7a085c6))
11
+
12
+ ## [1.0.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.8.0...@stream-io/video-client-1.0.0) (2024-05-07)
13
+
14
+
15
+ ### Features
16
+
17
+ * **v1:** release v1.0.0 ([06174cd](https://github.com/GetStream/stream-video-js/commit/06174cdfb4168a7401f56b03d0302f82c97b93ff))
18
+
5
19
  ## [0.8.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.13...@stream-io/video-client-0.8.0) (2024-05-07)
6
20
 
7
21
 
@@ -933,6 +933,9 @@ var TrackUnpublishReason;
933
933
  TrackUnpublishReason[TrackUnpublishReason["MODERATION"] = 3] = "MODERATION";
934
934
  })(TrackUnpublishReason || (TrackUnpublishReason = {}));
935
935
  /**
936
+ * GoAwayReason represents the reason for the SFU to
937
+ * disconnect the client.
938
+ *
936
939
  * @generated from protobuf enum stream.video.sfu.models.GoAwayReason
937
940
  */
938
941
  var GoAwayReason;
@@ -950,6 +953,75 @@ var GoAwayReason;
950
953
  */
951
954
  GoAwayReason[GoAwayReason["REBALANCE"] = 2] = "REBALANCE";
952
955
  })(GoAwayReason || (GoAwayReason = {}));
956
+ /**
957
+ * CallEndedReason represents the reason for the call to end.
958
+ *
959
+ * @generated from protobuf enum stream.video.sfu.models.CallEndedReason
960
+ */
961
+ var CallEndedReason;
962
+ (function (CallEndedReason) {
963
+ /**
964
+ * @generated from protobuf enum value: CALL_ENDED_REASON_UNSPECIFIED = 0;
965
+ */
966
+ CallEndedReason[CallEndedReason["UNSPECIFIED"] = 0] = "UNSPECIFIED";
967
+ /**
968
+ * @generated from protobuf enum value: CALL_ENDED_REASON_ENDED = 1;
969
+ */
970
+ CallEndedReason[CallEndedReason["ENDED"] = 1] = "ENDED";
971
+ /**
972
+ * @generated from protobuf enum value: CALL_ENDED_REASON_LIVE_ENDED = 2;
973
+ */
974
+ CallEndedReason[CallEndedReason["LIVE_ENDED"] = 2] = "LIVE_ENDED";
975
+ /**
976
+ * @generated from protobuf enum value: CALL_ENDED_REASON_KICKED = 3;
977
+ */
978
+ CallEndedReason[CallEndedReason["KICKED"] = 3] = "KICKED";
979
+ })(CallEndedReason || (CallEndedReason = {}));
980
+ /**
981
+ * WebsocketReconnectStrategy defines the ws strategies available for handling reconnections.
982
+ *
983
+ * @generated from protobuf enum stream.video.sfu.models.WebsocketReconnectStrategy
984
+ */
985
+ var WebsocketReconnectStrategy;
986
+ (function (WebsocketReconnectStrategy) {
987
+ /**
988
+ * @generated from protobuf enum value: WEBSOCKET_RECONNECT_STRATEGY_UNSPECIFIED = 0;
989
+ */
990
+ WebsocketReconnectStrategy[WebsocketReconnectStrategy["UNSPECIFIED"] = 0] = "UNSPECIFIED";
991
+ /**
992
+ * Sent after reaching the maximum reconnection attempts, leading to permanent disconnect.
993
+ *
994
+ * @generated from protobuf enum value: WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT = 1;
995
+ */
996
+ WebsocketReconnectStrategy[WebsocketReconnectStrategy["DISCONNECT"] = 1] = "DISCONNECT";
997
+ /**
998
+ * SDK should maintaining existing publisher/subscriber pc instances
999
+ * and establish a new WebSocket connection.
1000
+ *
1001
+ * @generated from protobuf enum value: WEBSOCKET_RECONNECT_STRATEGY_FAST = 2;
1002
+ */
1003
+ WebsocketReconnectStrategy[WebsocketReconnectStrategy["FAST"] = 2] = "FAST";
1004
+ /**
1005
+ * SDK should drop existing pc instances and creates a fresh WebSocket connection,
1006
+ * ensuring a clean state for the reconnection.
1007
+ *
1008
+ * @generated from protobuf enum value: WEBSOCKET_RECONNECT_STRATEGY_CLEAN = 3;
1009
+ */
1010
+ WebsocketReconnectStrategy[WebsocketReconnectStrategy["CLEAN"] = 3] = "CLEAN";
1011
+ /**
1012
+ * SDK should obtain new credentials from the coordinator, drops existing pc instances, and initializes
1013
+ * a completely new WebSocket connection, ensuring a comprehensive reset.
1014
+ *
1015
+ * @generated from protobuf enum value: WEBSOCKET_RECONNECT_STRATEGY_FULL = 4;
1016
+ */
1017
+ WebsocketReconnectStrategy[WebsocketReconnectStrategy["FULL"] = 4] = "FULL";
1018
+ /**
1019
+ * SDK should migrate to a new SFU instance
1020
+ *
1021
+ * @generated from protobuf enum value: WEBSOCKET_RECONNECT_STRATEGY_MIGRATE = 5;
1022
+ */
1023
+ WebsocketReconnectStrategy[WebsocketReconnectStrategy["MIGRATE"] = 5] = "MIGRATE";
1024
+ })(WebsocketReconnectStrategy || (WebsocketReconnectStrategy = {}));
953
1025
  // @generated message type with reflection information, may provide speed optimized methods
954
1026
  class CallState$Type extends MessageType {
955
1027
  constructor() {
@@ -2412,6 +2484,7 @@ var models = /*#__PURE__*/Object.freeze({
2412
2484
  __proto__: null,
2413
2485
  Browser: Browser,
2414
2486
  Call: Call$1,
2487
+ get CallEndedReason () { return CallEndedReason; },
2415
2488
  CallGrants: CallGrants,
2416
2489
  CallState: CallState$1,
2417
2490
  ClientDetails: ClientDetails,
@@ -2435,7 +2508,8 @@ var models = /*#__PURE__*/Object.freeze({
2435
2508
  get TrackUnpublishReason () { return TrackUnpublishReason; },
2436
2509
  VideoDimension: VideoDimension,
2437
2510
  VideoLayer: VideoLayer,
2438
- get VideoQuality () { return VideoQuality; }
2511
+ get VideoQuality () { return VideoQuality; },
2512
+ get WebsocketReconnectStrategy () { return WebsocketReconnectStrategy; }
2439
2513
  });
2440
2514
 
2441
2515
  /* eslint-disable */
@@ -3844,6 +3918,20 @@ class SfuEvent$Type extends MessageType {
3844
3918
  oneof: 'eventPayload',
3845
3919
  T: () => PinsChanged,
3846
3920
  },
3921
+ {
3922
+ no: 23,
3923
+ name: 'call_ended',
3924
+ kind: 'message',
3925
+ oneof: 'eventPayload',
3926
+ T: () => CallEnded,
3927
+ },
3928
+ {
3929
+ no: 24,
3930
+ name: 'participant_updated',
3931
+ kind: 'message',
3932
+ oneof: 'eventPayload',
3933
+ T: () => ParticipantUpdated,
3934
+ },
3847
3935
  ]);
3848
3936
  }
3849
3937
  create(value) {
@@ -3966,6 +4054,18 @@ class SfuEvent$Type extends MessageType {
3966
4054
  pinsUpdated: PinsChanged.internalBinaryRead(reader, reader.uint32(), options, message.eventPayload.pinsUpdated),
3967
4055
  };
3968
4056
  break;
4057
+ case /* stream.video.sfu.event.CallEnded call_ended */ 23:
4058
+ message.eventPayload = {
4059
+ oneofKind: 'callEnded',
4060
+ callEnded: CallEnded.internalBinaryRead(reader, reader.uint32(), options, message.eventPayload.callEnded),
4061
+ };
4062
+ break;
4063
+ case /* stream.video.sfu.event.ParticipantUpdated participant_updated */ 24:
4064
+ message.eventPayload = {
4065
+ oneofKind: 'participantUpdated',
4066
+ participantUpdated: ParticipantUpdated.internalBinaryRead(reader, reader.uint32(), options, message.eventPayload.participantUpdated),
4067
+ };
4068
+ break;
3969
4069
  default:
3970
4070
  let u = options.readUnknownField;
3971
4071
  if (u === 'throw')
@@ -4032,6 +4132,12 @@ class SfuEvent$Type extends MessageType {
4032
4132
  /* stream.video.sfu.event.PinsChanged pins_updated = 22; */
4033
4133
  if (message.eventPayload.oneofKind === 'pinsUpdated')
4034
4134
  PinsChanged.internalBinaryWrite(message.eventPayload.pinsUpdated, writer.tag(22, WireType.LengthDelimited).fork(), options).join();
4135
+ /* stream.video.sfu.event.CallEnded call_ended = 23; */
4136
+ if (message.eventPayload.oneofKind === 'callEnded')
4137
+ CallEnded.internalBinaryWrite(message.eventPayload.callEnded, writer.tag(23, WireType.LengthDelimited).fork(), options).join();
4138
+ /* stream.video.sfu.event.ParticipantUpdated participant_updated = 24; */
4139
+ if (message.eventPayload.oneofKind === 'participantUpdated')
4140
+ ParticipantUpdated.internalBinaryWrite(message.eventPayload.participantUpdated, writer.tag(24, WireType.LengthDelimited).fork(), options).join();
4035
4141
  let u = options.writeUnknownFields;
4036
4142
  if (u !== false)
4037
4143
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -4100,10 +4206,21 @@ class Error$Type extends MessageType {
4100
4206
  constructor() {
4101
4207
  super('stream.video.sfu.event.Error', [
4102
4208
  { no: 4, name: 'error', kind: 'message', T: () => Error$2 },
4209
+ {
4210
+ no: 5,
4211
+ name: 'reconnect_strategy',
4212
+ kind: 'enum',
4213
+ T: () => [
4214
+ 'stream.video.sfu.models.WebsocketReconnectStrategy',
4215
+ WebsocketReconnectStrategy,
4216
+ 'WEBSOCKET_RECONNECT_STRATEGY_',
4217
+ ],
4218
+ },
4103
4219
  ]);
4104
4220
  }
4105
4221
  create(value) {
4106
4222
  const message = globalThis.Object.create(this.messagePrototype);
4223
+ message.reconnectStrategy = 0;
4107
4224
  if (value !== undefined)
4108
4225
  reflectionMergePartial(this, message, value);
4109
4226
  return message;
@@ -4116,6 +4233,9 @@ class Error$Type extends MessageType {
4116
4233
  case /* stream.video.sfu.models.Error error */ 4:
4117
4234
  message.error = Error$2.internalBinaryRead(reader, reader.uint32(), options, message.error);
4118
4235
  break;
4236
+ case /* stream.video.sfu.models.WebsocketReconnectStrategy reconnect_strategy */ 5:
4237
+ message.reconnectStrategy = reader.int32();
4238
+ break;
4119
4239
  default:
4120
4240
  let u = options.readUnknownField;
4121
4241
  if (u === 'throw')
@@ -4131,6 +4251,9 @@ class Error$Type extends MessageType {
4131
4251
  /* stream.video.sfu.models.Error error = 4; */
4132
4252
  if (message.error)
4133
4253
  Error$2.internalBinaryWrite(message.error, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
4254
+ /* stream.video.sfu.models.WebsocketReconnectStrategy reconnect_strategy = 5; */
4255
+ if (message.reconnectStrategy !== 0)
4256
+ writer.tag(5, WireType.Varint).int32(message.reconnectStrategy);
4134
4257
  let u = options.writeUnknownFields;
4135
4258
  if (u !== false)
4136
4259
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -4924,6 +5047,60 @@ class ParticipantLeft$Type extends MessageType {
4924
5047
  */
4925
5048
  const ParticipantLeft = new ParticipantLeft$Type();
4926
5049
  // @generated message type with reflection information, may provide speed optimized methods
5050
+ class ParticipantUpdated$Type extends MessageType {
5051
+ constructor() {
5052
+ super('stream.video.sfu.event.ParticipantUpdated', [
5053
+ { no: 1, name: 'call_cid', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
5054
+ { no: 2, name: 'participant', kind: 'message', T: () => Participant },
5055
+ ]);
5056
+ }
5057
+ create(value) {
5058
+ const message = globalThis.Object.create(this.messagePrototype);
5059
+ message.callCid = '';
5060
+ if (value !== undefined)
5061
+ reflectionMergePartial(this, message, value);
5062
+ return message;
5063
+ }
5064
+ internalBinaryRead(reader, length, options, target) {
5065
+ let message = target ?? this.create(), end = reader.pos + length;
5066
+ while (reader.pos < end) {
5067
+ let [fieldNo, wireType] = reader.tag();
5068
+ switch (fieldNo) {
5069
+ case /* string call_cid */ 1:
5070
+ message.callCid = reader.string();
5071
+ break;
5072
+ case /* stream.video.sfu.models.Participant participant */ 2:
5073
+ message.participant = Participant.internalBinaryRead(reader, reader.uint32(), options, message.participant);
5074
+ break;
5075
+ default:
5076
+ let u = options.readUnknownField;
5077
+ if (u === 'throw')
5078
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
5079
+ let d = reader.skip(wireType);
5080
+ if (u !== false)
5081
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
5082
+ }
5083
+ }
5084
+ return message;
5085
+ }
5086
+ internalBinaryWrite(message, writer, options) {
5087
+ /* string call_cid = 1; */
5088
+ if (message.callCid !== '')
5089
+ writer.tag(1, WireType.LengthDelimited).string(message.callCid);
5090
+ /* stream.video.sfu.models.Participant participant = 2; */
5091
+ if (message.participant)
5092
+ Participant.internalBinaryWrite(message.participant, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
5093
+ let u = options.writeUnknownFields;
5094
+ if (u !== false)
5095
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
5096
+ return writer;
5097
+ }
5098
+ }
5099
+ /**
5100
+ * @generated MessageType for protobuf message stream.video.sfu.event.ParticipantUpdated
5101
+ */
5102
+ const ParticipantUpdated = new ParticipantUpdated$Type();
5103
+ // @generated message type with reflection information, may provide speed optimized methods
4927
5104
  class SubscriberOffer$Type extends MessageType {
4928
5105
  constructor() {
4929
5106
  super('stream.video.sfu.event.SubscriberOffer', [
@@ -5874,6 +6051,62 @@ class GoAway$Type extends MessageType {
5874
6051
  * @generated MessageType for protobuf message stream.video.sfu.event.GoAway
5875
6052
  */
5876
6053
  const GoAway = new GoAway$Type();
6054
+ // @generated message type with reflection information, may provide speed optimized methods
6055
+ class CallEnded$Type extends MessageType {
6056
+ constructor() {
6057
+ super('stream.video.sfu.event.CallEnded', [
6058
+ {
6059
+ no: 1,
6060
+ name: 'reason',
6061
+ kind: 'enum',
6062
+ T: () => [
6063
+ 'stream.video.sfu.models.CallEndedReason',
6064
+ CallEndedReason,
6065
+ 'CALL_ENDED_REASON_',
6066
+ ],
6067
+ },
6068
+ ]);
6069
+ }
6070
+ create(value) {
6071
+ const message = globalThis.Object.create(this.messagePrototype);
6072
+ message.reason = 0;
6073
+ if (value !== undefined)
6074
+ reflectionMergePartial(this, message, value);
6075
+ return message;
6076
+ }
6077
+ internalBinaryRead(reader, length, options, target) {
6078
+ let message = target ?? this.create(), end = reader.pos + length;
6079
+ while (reader.pos < end) {
6080
+ let [fieldNo, wireType] = reader.tag();
6081
+ switch (fieldNo) {
6082
+ case /* stream.video.sfu.models.CallEndedReason reason */ 1:
6083
+ message.reason = reader.int32();
6084
+ break;
6085
+ default:
6086
+ let u = options.readUnknownField;
6087
+ if (u === 'throw')
6088
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
6089
+ let d = reader.skip(wireType);
6090
+ if (u !== false)
6091
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
6092
+ }
6093
+ }
6094
+ return message;
6095
+ }
6096
+ internalBinaryWrite(message, writer, options) {
6097
+ /* stream.video.sfu.models.CallEndedReason reason = 1; */
6098
+ if (message.reason !== 0)
6099
+ writer.tag(1, WireType.Varint).int32(message.reason);
6100
+ let u = options.writeUnknownFields;
6101
+ if (u !== false)
6102
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
6103
+ return writer;
6104
+ }
6105
+ }
6106
+ /**
6107
+ * @generated MessageType for protobuf message stream.video.sfu.event.CallEnded
6108
+ */
6109
+ const CallEnded = new CallEnded$Type();
5877
6110
 
5878
6111
  var events = /*#__PURE__*/Object.freeze({
5879
6112
  __proto__: null,
@@ -5881,6 +6114,7 @@ var events = /*#__PURE__*/Object.freeze({
5881
6114
  AudioLevelChanged: AudioLevelChanged,
5882
6115
  AudioMediaRequest: AudioMediaRequest,
5883
6116
  AudioSender: AudioSender,
6117
+ CallEnded: CallEnded,
5884
6118
  CallGrantsUpdated: CallGrantsUpdated,
5885
6119
  ChangePublishQuality: ChangePublishQuality,
5886
6120
  ConnectionQualityChanged: ConnectionQualityChanged,
@@ -5897,6 +6131,7 @@ var events = /*#__PURE__*/Object.freeze({
5897
6131
  Migration: Migration,
5898
6132
  ParticipantJoined: ParticipantJoined,
5899
6133
  ParticipantLeft: ParticipantLeft,
6134
+ ParticipantUpdated: ParticipantUpdated,
5900
6135
  PinsChanged: PinsChanged,
5901
6136
  PublisherAnswer: PublisherAnswer,
5902
6137
  SfuEvent: SfuEvent,
@@ -6177,6 +6412,8 @@ const sfuEventKinds = {
6177
6412
  goAway: undefined,
6178
6413
  iceRestart: undefined,
6179
6414
  pinsUpdated: undefined,
6415
+ callEnded: undefined,
6416
+ participantUpdated: undefined,
6180
6417
  };
6181
6418
  const isSfuEvent = (eventName) => {
6182
6419
  return Object.prototype.hasOwnProperty.call(sfuEventKinds, eventName);
@@ -7116,9 +7353,11 @@ class CallState {
7116
7353
  this.setCurrentValue(this.thumbnailsSubject, call.thumbnails);
7117
7354
  };
7118
7355
  this.updateFromMemberRemoved = (event) => {
7356
+ this.updateFromCallResponse(event.call);
7119
7357
  this.setCurrentValue(this.membersSubject, (members) => members.filter((m) => event.members.indexOf(m.user_id) === -1));
7120
7358
  };
7121
7359
  this.updateFromMemberAdded = (event) => {
7360
+ this.updateFromCallResponse(event.call);
7122
7361
  this.setCurrentValue(this.membersSubject, (members) => [
7123
7362
  ...members,
7124
7363
  ...event.members,
@@ -7202,6 +7441,7 @@ class CallState {
7202
7441
  });
7203
7442
  };
7204
7443
  this.updateMembers = (event) => {
7444
+ this.updateFromCallResponse(event.call);
7205
7445
  this.setCurrentValue(this.membersSubject, (members) => members.map((member) => {
7206
7446
  const memberUpdate = event.members.find((m) => m.user_id === member.user_id);
7207
7447
  return memberUpdate ? memberUpdate : member;
@@ -9330,6 +9570,17 @@ const watchParticipantLeft = (state) => {
9330
9570
  state.setParticipants((participants) => participants.filter((p) => p.sessionId !== participant.sessionId));
9331
9571
  };
9332
9572
  };
9573
+ /**
9574
+ * An event responder which handles the `participantUpdated` event.
9575
+ */
9576
+ const watchParticipantUpdated = (state) => {
9577
+ return function onParticipantUpdated(e) {
9578
+ const { participant } = e;
9579
+ if (!participant)
9580
+ return;
9581
+ state.updateParticipant(participant.sessionId, participant);
9582
+ };
9583
+ };
9333
9584
  /**
9334
9585
  * An event responder which handles the `trackPublished` event.
9335
9586
  * The SFU will send this event when a participant publishes a track.
@@ -9431,6 +9682,7 @@ const registerEventHandlers = (call, state, dispatcher) => {
9431
9682
  watchParticipantCountChanged(dispatcher, state),
9432
9683
  call.on('participantJoined', watchParticipantJoined(state)),
9433
9684
  call.on('participantLeft', watchParticipantLeft(state)),
9685
+ call.on('participantUpdated', watchParticipantUpdated(state)),
9434
9686
  call.on('trackPublished', watchTrackPublished(state)),
9435
9687
  call.on('trackUnpublished', watchTrackUnpublished(state)),
9436
9688
  watchAudioLevelChanged(dispatcher, state),
@@ -14893,7 +15145,7 @@ class StreamClient {
14893
15145
  });
14894
15146
  };
14895
15147
  this.getUserAgent = () => {
14896
- const version = "0.8.0" ;
15148
+ const version = "1.0.1" ;
14897
15149
  return (this.userAgent ||
14898
15150
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14899
15151
  };