@stream-io/video-client 0.0.37 → 0.0.39
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 +14 -0
- package/dist/index.browser.es.js +9 -4
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +9 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +9 -4
- package/dist/index.es.js.map +1 -1
- package/dist/src/gen/coordinator/index.d.ts +26 -0
- package/package.json +1 -1
- package/src/events/__tests__/sessions.test.ts +5 -0
- package/src/events/sessions.ts +7 -3
- package/src/gen/coordinator/index.ts +26 -0
- package/src/rtc/Publisher.ts +1 -0
|
@@ -148,6 +148,7 @@ export interface AudioSettings {
|
|
|
148
148
|
*/
|
|
149
149
|
export declare const AudioSettingsDefaultDeviceEnum: {
|
|
150
150
|
readonly SPEAKER: "speaker";
|
|
151
|
+
readonly EARPIECE: "earpiece";
|
|
151
152
|
};
|
|
152
153
|
export type AudioSettingsDefaultDeviceEnum = (typeof AudioSettingsDefaultDeviceEnum)[keyof typeof AudioSettingsDefaultDeviceEnum];
|
|
153
154
|
/**
|
|
@@ -198,6 +199,7 @@ export interface AudioSettingsRequest {
|
|
|
198
199
|
*/
|
|
199
200
|
export declare const AudioSettingsRequestDefaultDeviceEnum: {
|
|
200
201
|
readonly SPEAKER: "speaker";
|
|
202
|
+
readonly EARPIECE: "earpiece";
|
|
201
203
|
};
|
|
202
204
|
export type AudioSettingsRequestDefaultDeviceEnum = (typeof AudioSettingsRequestDefaultDeviceEnum)[keyof typeof AudioSettingsRequestDefaultDeviceEnum];
|
|
203
205
|
/**
|
|
@@ -732,12 +734,24 @@ export interface CallParticipantResponse {
|
|
|
732
734
|
* @memberof CallParticipantResponse
|
|
733
735
|
*/
|
|
734
736
|
joined_at: string;
|
|
737
|
+
/**
|
|
738
|
+
*
|
|
739
|
+
* @type {string}
|
|
740
|
+
* @memberof CallParticipantResponse
|
|
741
|
+
*/
|
|
742
|
+
role: string;
|
|
735
743
|
/**
|
|
736
744
|
*
|
|
737
745
|
* @type {UserResponse}
|
|
738
746
|
* @memberof CallParticipantResponse
|
|
739
747
|
*/
|
|
740
748
|
user: UserResponse;
|
|
749
|
+
/**
|
|
750
|
+
*
|
|
751
|
+
* @type {string}
|
|
752
|
+
* @memberof CallParticipantResponse
|
|
753
|
+
*/
|
|
754
|
+
user_session_id: string;
|
|
741
755
|
}
|
|
742
756
|
/**
|
|
743
757
|
* This event is sent when a reaction is sent in a call, clients should use this to show the reaction in the call screen
|
|
@@ -1184,6 +1198,12 @@ export interface CallSessionParticipantJoinedEvent {
|
|
|
1184
1198
|
* @memberof CallSessionParticipantJoinedEvent
|
|
1185
1199
|
*/
|
|
1186
1200
|
user: UserResponse;
|
|
1201
|
+
/**
|
|
1202
|
+
* The user session ID of the user that joined the call session
|
|
1203
|
+
* @type {string}
|
|
1204
|
+
* @memberof CallSessionParticipantJoinedEvent
|
|
1205
|
+
*/
|
|
1206
|
+
user_session_id: string;
|
|
1187
1207
|
}
|
|
1188
1208
|
/**
|
|
1189
1209
|
* This event is sent when a participant leaves a call session
|
|
@@ -1221,6 +1241,12 @@ export interface CallSessionParticipantLeftEvent {
|
|
|
1221
1241
|
* @memberof CallSessionParticipantLeftEvent
|
|
1222
1242
|
*/
|
|
1223
1243
|
user: UserResponse;
|
|
1244
|
+
/**
|
|
1245
|
+
* The user session ID of the user that left the call session
|
|
1246
|
+
* @type {string}
|
|
1247
|
+
* @memberof CallSessionParticipantLeftEvent
|
|
1248
|
+
*/
|
|
1249
|
+
user_session_id: string;
|
|
1224
1250
|
}
|
|
1225
1251
|
/**
|
|
1226
1252
|
*
|
package/package.json
CHANGED
|
@@ -68,6 +68,7 @@ describe('call.session events', () => {
|
|
|
68
68
|
id: 'user-id',
|
|
69
69
|
role: 'user',
|
|
70
70
|
},
|
|
71
|
+
user_session_id: '123',
|
|
71
72
|
});
|
|
72
73
|
expect(state.metadata).toEqual({
|
|
73
74
|
session: {
|
|
@@ -78,6 +79,8 @@ describe('call.session events', () => {
|
|
|
78
79
|
id: 'user-id',
|
|
79
80
|
role: 'user',
|
|
80
81
|
},
|
|
82
|
+
user_session_id: '123',
|
|
83
|
+
role: 'user',
|
|
81
84
|
},
|
|
82
85
|
],
|
|
83
86
|
participants_count_by_role: {
|
|
@@ -100,6 +103,7 @@ describe('call.session events', () => {
|
|
|
100
103
|
id: 'user-id',
|
|
101
104
|
role: 'user',
|
|
102
105
|
},
|
|
106
|
+
user_session_id: '123',
|
|
103
107
|
},
|
|
104
108
|
],
|
|
105
109
|
participants_count_by_role: {
|
|
@@ -115,6 +119,7 @@ describe('call.session events', () => {
|
|
|
115
119
|
id: 'user-id',
|
|
116
120
|
role: 'user',
|
|
117
121
|
},
|
|
122
|
+
user_session_id: '123',
|
|
118
123
|
});
|
|
119
124
|
expect(state.metadata).toEqual({
|
|
120
125
|
session: {
|
package/src/events/sessions.ts
CHANGED
|
@@ -33,7 +33,7 @@ export const watchCallSessionEnded = (state: CallState) => {
|
|
|
33
33
|
export const watchCallSessionParticipantJoined = (state: CallState) => {
|
|
34
34
|
return function onCallParticipantJoined(event: StreamVideoEvent) {
|
|
35
35
|
if (event.type !== 'call.session_participant_joined') return;
|
|
36
|
-
const { user } = event;
|
|
36
|
+
const { user, user_session_id } = event;
|
|
37
37
|
state.setMetadata((metadata) => {
|
|
38
38
|
if (!metadata || !metadata.session) {
|
|
39
39
|
state.logger(
|
|
@@ -55,6 +55,8 @@ export const watchCallSessionParticipantJoined = (state: CallState) => {
|
|
|
55
55
|
// FIXME OL: ideally, this comes from the backend
|
|
56
56
|
joined_at: new Date().toISOString(),
|
|
57
57
|
user,
|
|
58
|
+
role: user.role,
|
|
59
|
+
user_session_id,
|
|
58
60
|
},
|
|
59
61
|
],
|
|
60
62
|
participants_count_by_role: {
|
|
@@ -75,7 +77,7 @@ export const watchCallSessionParticipantJoined = (state: CallState) => {
|
|
|
75
77
|
export const watchCallSessionParticipantLeft = (state: CallState) => {
|
|
76
78
|
return function onCallParticipantLeft(event: StreamVideoEvent) {
|
|
77
79
|
if (event.type !== 'call.session_participant_left') return;
|
|
78
|
-
const { user } = event;
|
|
80
|
+
const { user, user_session_id } = event;
|
|
79
81
|
state.setMetadata((metadata) => {
|
|
80
82
|
if (!metadata || !metadata.session) {
|
|
81
83
|
state.logger(
|
|
@@ -91,7 +93,9 @@ export const watchCallSessionParticipantLeft = (state: CallState) => {
|
|
|
91
93
|
...metadata,
|
|
92
94
|
session: {
|
|
93
95
|
...session,
|
|
94
|
-
participants: participants.filter(
|
|
96
|
+
participants: participants.filter(
|
|
97
|
+
(p) => p.user_session_id !== user_session_id,
|
|
98
|
+
),
|
|
95
99
|
participants_count_by_role: {
|
|
96
100
|
...participants_count_by_role,
|
|
97
101
|
[user.role]: Math.max(
|
|
@@ -149,6 +149,7 @@ export interface AudioSettings {
|
|
|
149
149
|
*/
|
|
150
150
|
export const AudioSettingsDefaultDeviceEnum = {
|
|
151
151
|
SPEAKER: 'speaker',
|
|
152
|
+
EARPIECE: 'earpiece',
|
|
152
153
|
} as const;
|
|
153
154
|
export type AudioSettingsDefaultDeviceEnum =
|
|
154
155
|
(typeof AudioSettingsDefaultDeviceEnum)[keyof typeof AudioSettingsDefaultDeviceEnum];
|
|
@@ -202,6 +203,7 @@ export interface AudioSettingsRequest {
|
|
|
202
203
|
*/
|
|
203
204
|
export const AudioSettingsRequestDefaultDeviceEnum = {
|
|
204
205
|
SPEAKER: 'speaker',
|
|
206
|
+
EARPIECE: 'earpiece',
|
|
205
207
|
} as const;
|
|
206
208
|
export type AudioSettingsRequestDefaultDeviceEnum =
|
|
207
209
|
(typeof AudioSettingsRequestDefaultDeviceEnum)[keyof typeof AudioSettingsRequestDefaultDeviceEnum];
|
|
@@ -736,12 +738,24 @@ export interface CallParticipantResponse {
|
|
|
736
738
|
* @memberof CallParticipantResponse
|
|
737
739
|
*/
|
|
738
740
|
joined_at: string;
|
|
741
|
+
/**
|
|
742
|
+
*
|
|
743
|
+
* @type {string}
|
|
744
|
+
* @memberof CallParticipantResponse
|
|
745
|
+
*/
|
|
746
|
+
role: string;
|
|
739
747
|
/**
|
|
740
748
|
*
|
|
741
749
|
* @type {UserResponse}
|
|
742
750
|
* @memberof CallParticipantResponse
|
|
743
751
|
*/
|
|
744
752
|
user: UserResponse;
|
|
753
|
+
/**
|
|
754
|
+
*
|
|
755
|
+
* @type {string}
|
|
756
|
+
* @memberof CallParticipantResponse
|
|
757
|
+
*/
|
|
758
|
+
user_session_id: string;
|
|
745
759
|
}
|
|
746
760
|
/**
|
|
747
761
|
* This event is sent when a reaction is sent in a call, clients should use this to show the reaction in the call screen
|
|
@@ -1184,6 +1198,12 @@ export interface CallSessionParticipantJoinedEvent {
|
|
|
1184
1198
|
* @memberof CallSessionParticipantJoinedEvent
|
|
1185
1199
|
*/
|
|
1186
1200
|
user: UserResponse;
|
|
1201
|
+
/**
|
|
1202
|
+
* The user session ID of the user that joined the call session
|
|
1203
|
+
* @type {string}
|
|
1204
|
+
* @memberof CallSessionParticipantJoinedEvent
|
|
1205
|
+
*/
|
|
1206
|
+
user_session_id: string;
|
|
1187
1207
|
}
|
|
1188
1208
|
/**
|
|
1189
1209
|
* This event is sent when a participant leaves a call session
|
|
@@ -1221,6 +1241,12 @@ export interface CallSessionParticipantLeftEvent {
|
|
|
1221
1241
|
* @memberof CallSessionParticipantLeftEvent
|
|
1222
1242
|
*/
|
|
1223
1243
|
user: UserResponse;
|
|
1244
|
+
/**
|
|
1245
|
+
* The user session ID of the user that left the call session
|
|
1246
|
+
* @type {string}
|
|
1247
|
+
* @memberof CallSessionParticipantLeftEvent
|
|
1248
|
+
*/
|
|
1249
|
+
user_session_id: string;
|
|
1224
1250
|
}
|
|
1225
1251
|
/**
|
|
1226
1252
|
*
|