@stream-io/video-client 0.0.1-alpha.144 → 0.0.1-alpha.146
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 +18 -0
- package/dist/index.browser.es.js +157 -29
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +157 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +157 -29
- package/dist/index.es.js.map +1 -1
- package/dist/src/gen/video/sfu/event/events.d.ts +3 -7
- package/dist/src/gen/video/sfu/models/models.d.ts +49 -0
- package/dist/src/store/CallState.d.ts +47 -0
- package/package.json +1 -1
- package/src/Call.ts +8 -0
- package/src/CallType.ts +1 -1
- package/src/events/internal.ts +5 -2
- package/src/gen/video/sfu/event/events.ts +21 -27
- package/src/gen/video/sfu/models/models.ts +155 -0
- package/src/rtc/signal.ts +14 -5
- package/src/store/CallState.ts +66 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.1-alpha.146](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.145...client0.0.1-alpha.146) (2023-05-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* correct audio_room call type name ([#502](https://github.com/GetStream/stream-video-js/issues/502)) ([c15d129](https://github.com/GetStream/stream-video-js/commit/c15d129df1dd0d587ef4b2796a989fd0b161237a))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.0.1-alpha.145](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.144...client0.0.1-alpha.145) (2023-05-16)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Participant Count and Call StartedAt ([#504](https://github.com/GetStream/stream-video-js/issues/504)) ([c071139](https://github.com/GetStream/stream-video-js/commit/c071139c0c1fc2401941fc38bed077be0875b470))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
5
23
|
## [0.0.1-alpha.144](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.143...client0.0.1-alpha.144) (2023-05-16)
|
|
6
24
|
|
|
7
25
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -818,6 +818,13 @@ class CallState$Type extends MessageType {
|
|
|
818
818
|
repeat: 1 /*RepeatType.PACKED*/,
|
|
819
819
|
T: () => Participant,
|
|
820
820
|
},
|
|
821
|
+
{ no: 2, name: 'started_at', kind: 'message', T: () => Timestamp },
|
|
822
|
+
{
|
|
823
|
+
no: 3,
|
|
824
|
+
name: 'participant_count',
|
|
825
|
+
kind: 'message',
|
|
826
|
+
T: () => ParticipantCount,
|
|
827
|
+
},
|
|
821
828
|
]);
|
|
822
829
|
}
|
|
823
830
|
create(value) {
|
|
@@ -838,6 +845,12 @@ class CallState$Type extends MessageType {
|
|
|
838
845
|
case /* repeated stream.video.sfu.models.Participant participants */ 1:
|
|
839
846
|
message.participants.push(Participant.internalBinaryRead(reader, reader.uint32(), options));
|
|
840
847
|
break;
|
|
848
|
+
case /* google.protobuf.Timestamp started_at */ 2:
|
|
849
|
+
message.startedAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.startedAt);
|
|
850
|
+
break;
|
|
851
|
+
case /* stream.video.sfu.models.ParticipantCount participant_count */ 3:
|
|
852
|
+
message.participantCount = ParticipantCount.internalBinaryRead(reader, reader.uint32(), options, message.participantCount);
|
|
853
|
+
break;
|
|
841
854
|
default:
|
|
842
855
|
let u = options.readUnknownField;
|
|
843
856
|
if (u === 'throw')
|
|
@@ -853,6 +866,12 @@ class CallState$Type extends MessageType {
|
|
|
853
866
|
/* repeated stream.video.sfu.models.Participant participants = 1; */
|
|
854
867
|
for (let i = 0; i < message.participants.length; i++)
|
|
855
868
|
Participant.internalBinaryWrite(message.participants[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
869
|
+
/* google.protobuf.Timestamp started_at = 2; */
|
|
870
|
+
if (message.startedAt)
|
|
871
|
+
Timestamp.internalBinaryWrite(message.startedAt, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
872
|
+
/* stream.video.sfu.models.ParticipantCount participant_count = 3; */
|
|
873
|
+
if (message.participantCount)
|
|
874
|
+
ParticipantCount.internalBinaryWrite(message.participantCount, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
856
875
|
let u = options.writeUnknownFields;
|
|
857
876
|
if (u !== false)
|
|
858
877
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -864,6 +883,63 @@ class CallState$Type extends MessageType {
|
|
|
864
883
|
*/
|
|
865
884
|
const CallState$1 = new CallState$Type();
|
|
866
885
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
886
|
+
class ParticipantCount$Type extends MessageType {
|
|
887
|
+
constructor() {
|
|
888
|
+
super('stream.video.sfu.models.ParticipantCount', [
|
|
889
|
+
{ no: 1, name: 'total', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
|
|
890
|
+
{ no: 2, name: 'anonymous', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
|
|
891
|
+
]);
|
|
892
|
+
}
|
|
893
|
+
create(value) {
|
|
894
|
+
const message = { total: 0, anonymous: 0 };
|
|
895
|
+
globalThis.Object.defineProperty(message, MESSAGE_TYPE, {
|
|
896
|
+
enumerable: false,
|
|
897
|
+
value: this,
|
|
898
|
+
});
|
|
899
|
+
if (value !== undefined)
|
|
900
|
+
reflectionMergePartial(this, message, value);
|
|
901
|
+
return message;
|
|
902
|
+
}
|
|
903
|
+
internalBinaryRead(reader, length, options, target) {
|
|
904
|
+
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
|
905
|
+
while (reader.pos < end) {
|
|
906
|
+
let [fieldNo, wireType] = reader.tag();
|
|
907
|
+
switch (fieldNo) {
|
|
908
|
+
case /* uint32 total */ 1:
|
|
909
|
+
message.total = reader.uint32();
|
|
910
|
+
break;
|
|
911
|
+
case /* uint32 anonymous */ 2:
|
|
912
|
+
message.anonymous = reader.uint32();
|
|
913
|
+
break;
|
|
914
|
+
default:
|
|
915
|
+
let u = options.readUnknownField;
|
|
916
|
+
if (u === 'throw')
|
|
917
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
918
|
+
let d = reader.skip(wireType);
|
|
919
|
+
if (u !== false)
|
|
920
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
return message;
|
|
924
|
+
}
|
|
925
|
+
internalBinaryWrite(message, writer, options) {
|
|
926
|
+
/* uint32 total = 1; */
|
|
927
|
+
if (message.total !== 0)
|
|
928
|
+
writer.tag(1, WireType.Varint).uint32(message.total);
|
|
929
|
+
/* uint32 anonymous = 2; */
|
|
930
|
+
if (message.anonymous !== 0)
|
|
931
|
+
writer.tag(2, WireType.Varint).uint32(message.anonymous);
|
|
932
|
+
let u = options.writeUnknownFields;
|
|
933
|
+
if (u !== false)
|
|
934
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
935
|
+
return writer;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* @generated MessageType for protobuf message stream.video.sfu.models.ParticipantCount
|
|
940
|
+
*/
|
|
941
|
+
const ParticipantCount = new ParticipantCount$Type();
|
|
942
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
867
943
|
class Participant$Type extends MessageType {
|
|
868
944
|
constructor() {
|
|
869
945
|
super('stream.video.sfu.models.Participant', [
|
|
@@ -2175,6 +2251,7 @@ var models = /*#__PURE__*/Object.freeze({
|
|
|
2175
2251
|
ICETrickle: ICETrickle$1,
|
|
2176
2252
|
OS: OS,
|
|
2177
2253
|
Participant: Participant,
|
|
2254
|
+
ParticipantCount: ParticipantCount,
|
|
2178
2255
|
get PeerType () { return PeerType; },
|
|
2179
2256
|
Sdk: Sdk,
|
|
2180
2257
|
get SdkType () { return SdkType; },
|
|
@@ -2720,13 +2797,13 @@ class HealthCheckResponse$Type extends MessageType {
|
|
|
2720
2797
|
{
|
|
2721
2798
|
no: 1,
|
|
2722
2799
|
name: 'participant_count',
|
|
2723
|
-
kind: '
|
|
2724
|
-
T:
|
|
2800
|
+
kind: 'message',
|
|
2801
|
+
T: () => ParticipantCount,
|
|
2725
2802
|
},
|
|
2726
2803
|
]);
|
|
2727
2804
|
}
|
|
2728
2805
|
create(value) {
|
|
2729
|
-
const message = {
|
|
2806
|
+
const message = {};
|
|
2730
2807
|
globalThis.Object.defineProperty(message, MESSAGE_TYPE, {
|
|
2731
2808
|
enumerable: false,
|
|
2732
2809
|
value: this,
|
|
@@ -2740,8 +2817,8 @@ class HealthCheckResponse$Type extends MessageType {
|
|
|
2740
2817
|
while (reader.pos < end) {
|
|
2741
2818
|
let [fieldNo, wireType] = reader.tag();
|
|
2742
2819
|
switch (fieldNo) {
|
|
2743
|
-
case /*
|
|
2744
|
-
message.participantCount = reader.uint32();
|
|
2820
|
+
case /* stream.video.sfu.models.ParticipantCount participant_count */ 1:
|
|
2821
|
+
message.participantCount = ParticipantCount.internalBinaryRead(reader, reader.uint32(), options, message.participantCount);
|
|
2745
2822
|
break;
|
|
2746
2823
|
default:
|
|
2747
2824
|
let u = options.readUnknownField;
|
|
@@ -2755,9 +2832,9 @@ class HealthCheckResponse$Type extends MessageType {
|
|
|
2755
2832
|
return message;
|
|
2756
2833
|
}
|
|
2757
2834
|
internalBinaryWrite(message, writer, options) {
|
|
2758
|
-
/*
|
|
2759
|
-
if (message.participantCount
|
|
2760
|
-
writer.tag(1, WireType.
|
|
2835
|
+
/* stream.video.sfu.models.ParticipantCount participant_count = 1; */
|
|
2836
|
+
if (message.participantCount)
|
|
2837
|
+
ParticipantCount.internalBinaryWrite(message.participantCount, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
2761
2838
|
let u = options.writeUnknownFields;
|
|
2762
2839
|
if (u !== false)
|
|
2763
2840
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -3030,16 +3107,10 @@ class JoinResponse$Type extends MessageType {
|
|
|
3030
3107
|
constructor() {
|
|
3031
3108
|
super('stream.video.sfu.event.JoinResponse', [
|
|
3032
3109
|
{ no: 1, name: 'call_state', kind: 'message', T: () => CallState$1 },
|
|
3033
|
-
{
|
|
3034
|
-
no: 2,
|
|
3035
|
-
name: 'participant_count',
|
|
3036
|
-
kind: 'scalar',
|
|
3037
|
-
T: 13 /*ScalarType.UINT32*/,
|
|
3038
|
-
},
|
|
3039
3110
|
]);
|
|
3040
3111
|
}
|
|
3041
3112
|
create(value) {
|
|
3042
|
-
const message = {
|
|
3113
|
+
const message = {};
|
|
3043
3114
|
globalThis.Object.defineProperty(message, MESSAGE_TYPE, {
|
|
3044
3115
|
enumerable: false,
|
|
3045
3116
|
value: this,
|
|
@@ -3056,9 +3127,6 @@ class JoinResponse$Type extends MessageType {
|
|
|
3056
3127
|
case /* stream.video.sfu.models.CallState call_state */ 1:
|
|
3057
3128
|
message.callState = CallState$1.internalBinaryRead(reader, reader.uint32(), options, message.callState);
|
|
3058
3129
|
break;
|
|
3059
|
-
case /* uint32 participant_count */ 2:
|
|
3060
|
-
message.participantCount = reader.uint32();
|
|
3061
|
-
break;
|
|
3062
3130
|
default:
|
|
3063
3131
|
let u = options.readUnknownField;
|
|
3064
3132
|
if (u === 'throw')
|
|
@@ -3074,9 +3142,6 @@ class JoinResponse$Type extends MessageType {
|
|
|
3074
3142
|
/* stream.video.sfu.models.CallState call_state = 1; */
|
|
3075
3143
|
if (message.callState)
|
|
3076
3144
|
CallState$1.internalBinaryWrite(message.callState, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
3077
|
-
/* uint32 participant_count = 2; */
|
|
3078
|
-
if (message.participantCount !== 0)
|
|
3079
|
-
writer.tag(2, WireType.Varint).uint32(message.participantCount);
|
|
3080
3145
|
let u = options.writeUnknownFields;
|
|
3081
3146
|
if (u !== false)
|
|
3082
3147
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -5868,10 +5933,15 @@ const createWebSocketSignalChannel = (opts) => {
|
|
|
5868
5933
|
});
|
|
5869
5934
|
if (onMessage) {
|
|
5870
5935
|
ws.addEventListener('message', (e) => {
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5936
|
+
try {
|
|
5937
|
+
const message = e.data instanceof ArrayBuffer
|
|
5938
|
+
? SfuEvent.fromBinary(new Uint8Array(e.data))
|
|
5939
|
+
: SfuEvent.fromJsonString(e.data);
|
|
5940
|
+
onMessage(message);
|
|
5941
|
+
}
|
|
5942
|
+
catch (err) {
|
|
5943
|
+
console.error('Failed to decode a message. Check whether the Proto models match.', e.data, e, err);
|
|
5944
|
+
}
|
|
5875
5945
|
});
|
|
5876
5946
|
}
|
|
5877
5947
|
return ws;
|
|
@@ -6496,6 +6566,12 @@ class CallState {
|
|
|
6496
6566
|
* @internal
|
|
6497
6567
|
*/
|
|
6498
6568
|
this.callingStateSubject = new BehaviorSubject(CallingState.UNKNOWN);
|
|
6569
|
+
/**
|
|
6570
|
+
* The time the call session actually started.
|
|
6571
|
+
*
|
|
6572
|
+
* @internal
|
|
6573
|
+
*/
|
|
6574
|
+
this.startedAtSubject = new BehaviorSubject(undefined);
|
|
6499
6575
|
/**
|
|
6500
6576
|
* The server-side counted number of participants connected to the current call.
|
|
6501
6577
|
* This number includes the anonymous participants as well.
|
|
@@ -6503,6 +6579,13 @@ class CallState {
|
|
|
6503
6579
|
* @internal
|
|
6504
6580
|
*/
|
|
6505
6581
|
this.participantCountSubject = new BehaviorSubject(0);
|
|
6582
|
+
/**
|
|
6583
|
+
* The server-side counted number of anonymous participants connected to the current call.
|
|
6584
|
+
* This number excludes the regular participants.
|
|
6585
|
+
*
|
|
6586
|
+
* @internal
|
|
6587
|
+
*/
|
|
6588
|
+
this.anonymousParticipantCountSubject = new BehaviorSubject(0);
|
|
6506
6589
|
/**
|
|
6507
6590
|
* All participants of the current call (including the logged-in user).
|
|
6508
6591
|
*
|
|
@@ -6576,6 +6659,24 @@ class CallState {
|
|
|
6576
6659
|
this.setParticipantCount = (count) => {
|
|
6577
6660
|
return this.setCurrentValue(this.participantCountSubject, count);
|
|
6578
6661
|
};
|
|
6662
|
+
/**
|
|
6663
|
+
* Sets the time the call session actually started.
|
|
6664
|
+
*
|
|
6665
|
+
* @internal
|
|
6666
|
+
* @param startedAt the time the call session actually started.
|
|
6667
|
+
*/
|
|
6668
|
+
this.setStartedAt = (startedAt) => {
|
|
6669
|
+
return this.setCurrentValue(this.startedAtSubject, startedAt);
|
|
6670
|
+
};
|
|
6671
|
+
/**
|
|
6672
|
+
* Sets the number of anonymous participants in the current call.
|
|
6673
|
+
*
|
|
6674
|
+
* @internal
|
|
6675
|
+
* @param count the number of anonymous participants.
|
|
6676
|
+
*/
|
|
6677
|
+
this.setAnonymousParticipantCount = (count) => {
|
|
6678
|
+
return this.setCurrentValue(this.anonymousParticipantCountSubject, count);
|
|
6679
|
+
};
|
|
6579
6680
|
/**
|
|
6580
6681
|
* Sets the list of participants in the current call.
|
|
6581
6682
|
*
|
|
@@ -6698,7 +6799,10 @@ class CallState {
|
|
|
6698
6799
|
this.hasOngoingScreenShare$ = this.participants$.pipe(map$1((participants) => {
|
|
6699
6800
|
return participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE));
|
|
6700
6801
|
}), distinctUntilChanged());
|
|
6802
|
+
this.startedAt$ = this.startedAtSubject.asObservable();
|
|
6701
6803
|
this.participantCount$ = this.participantCountSubject.asObservable();
|
|
6804
|
+
this.anonymousParticipantCount$ =
|
|
6805
|
+
this.anonymousParticipantCountSubject.asObservable();
|
|
6702
6806
|
this.callStatsReport$ = this.callStatsReportSubject.asObservable();
|
|
6703
6807
|
this.callPermissionRequest$ =
|
|
6704
6808
|
this.callPermissionRequestSubject.asObservable();
|
|
@@ -6714,6 +6818,20 @@ class CallState {
|
|
|
6714
6818
|
get participantCount() {
|
|
6715
6819
|
return this.getCurrentValue(this.participantCount$);
|
|
6716
6820
|
}
|
|
6821
|
+
/**
|
|
6822
|
+
* The time the call session actually started.
|
|
6823
|
+
* Useful for displaying the call duration.
|
|
6824
|
+
*/
|
|
6825
|
+
get startedAt() {
|
|
6826
|
+
return this.getCurrentValue(this.startedAt$);
|
|
6827
|
+
}
|
|
6828
|
+
/**
|
|
6829
|
+
* The server-side counted number of anonymous participants connected to the current call.
|
|
6830
|
+
* This number includes the anonymous participants as well.
|
|
6831
|
+
*/
|
|
6832
|
+
get anonymousParticipantCount() {
|
|
6833
|
+
return this.getCurrentValue(this.anonymousParticipantCount$);
|
|
6834
|
+
}
|
|
6717
6835
|
/**
|
|
6718
6836
|
* The list of participants in the current call.
|
|
6719
6837
|
*/
|
|
@@ -7102,8 +7220,11 @@ const watchParticipantCountChanged = (dispatcher, state) => {
|
|
|
7102
7220
|
return dispatcher.on('healthCheckResponse', (e) => {
|
|
7103
7221
|
if (e.eventPayload.oneofKind !== 'healthCheckResponse')
|
|
7104
7222
|
return;
|
|
7105
|
-
const
|
|
7106
|
-
|
|
7223
|
+
const { participantCount } = e.eventPayload.healthCheckResponse;
|
|
7224
|
+
if (participantCount) {
|
|
7225
|
+
state.setParticipantCount(participantCount.total);
|
|
7226
|
+
state.setAnonymousParticipantCount(participantCount.anonymous);
|
|
7227
|
+
}
|
|
7107
7228
|
});
|
|
7108
7229
|
};
|
|
7109
7230
|
|
|
@@ -7862,7 +7983,7 @@ const CallTypes = new CallTypesRegistry([
|
|
|
7862
7983
|
new CallType('livestream', {
|
|
7863
7984
|
sortParticipantsBy: livestreamOrAudioRoomSortPreset,
|
|
7864
7985
|
}),
|
|
7865
|
-
new CallType('
|
|
7986
|
+
new CallType('audio_room', {
|
|
7866
7987
|
sortParticipantsBy: livestreamOrAudioRoomSortPreset,
|
|
7867
7988
|
}),
|
|
7868
7989
|
]);
|
|
@@ -8184,7 +8305,14 @@ class Call {
|
|
|
8184
8305
|
// fails to respond in time
|
|
8185
8306
|
const { callState } = yield this.waitForJoinResponse();
|
|
8186
8307
|
const currentParticipants = (callState === null || callState === void 0 ? void 0 : callState.participants) || [];
|
|
8308
|
+
const participantCount = callState === null || callState === void 0 ? void 0 : callState.participantCount;
|
|
8309
|
+
const startedAt = (callState === null || callState === void 0 ? void 0 : callState.startedAt)
|
|
8310
|
+
? Timestamp.toDate(callState.startedAt)
|
|
8311
|
+
: new Date();
|
|
8187
8312
|
this.state.setParticipants(currentParticipants.map((participant) => (Object.assign(Object.assign({}, participant), { isLoggedInUser: participant.sessionId === sfuClient.sessionId, viewportVisibilityState: VisibilityState.UNKNOWN }))));
|
|
8313
|
+
this.state.setParticipantCount((participantCount === null || participantCount === void 0 ? void 0 : participantCount.total) || 0);
|
|
8314
|
+
this.state.setAnonymousParticipantCount((participantCount === null || participantCount === void 0 ? void 0 : participantCount.anonymous) || 0);
|
|
8315
|
+
this.state.setStartedAt(startedAt);
|
|
8188
8316
|
this.reconnectAttempts = 0; // reset the reconnect attempts counter
|
|
8189
8317
|
this.state.setCallingState(CallingState.JOINED);
|
|
8190
8318
|
console.log(`Joined call ${this.cid}`);
|
|
@@ -10492,7 +10620,7 @@ class StreamClient {
|
|
|
10492
10620
|
}
|
|
10493
10621
|
getUserAgent() {
|
|
10494
10622
|
return (this.userAgent ||
|
|
10495
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.
|
|
10623
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.145"}`);
|
|
10496
10624
|
}
|
|
10497
10625
|
setUserAgent(userAgent) {
|
|
10498
10626
|
this.userAgent = userAgent;
|