Skip to content

Commit a88c9e5

Browse files
committed
add timeline
1 parent bb8be9e commit a88c9e5

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

packages/client/src/Call.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,13 +2237,10 @@ export class Call {
22372237

22382238
/**
22392239
* Allows you to grant or revoke a specific permission to a user in a call. The permissions are specific to the call experience and do not survive the call itself.
2240-
*
22412240
* When revoking a permission, this endpoint will also mute the relevant track from the user. This is similar to muting a user with the difference that the user will not be able to unmute afterwards.
2242-
*
22432241
* Supported permissions that can be granted or revoked: `send-audio`, `send-video` and `screenshare`.
22442242
*
22452243
* `call.permissions_updated` event is sent to all members of the call.
2246-
*
22472244
*/
22482245
updateUserPermissions = async (data: UpdateUserPermissionsRequest) => {
22492246
return this.streamClient.post<
@@ -2567,18 +2564,23 @@ export class Call {
25672564
sessionId?: string;
25682565
userId?: string;
25692566
userSessionId?: string;
2567+
kind?: 'timeline' | 'details';
25702568
}): Promise<any> => {
25712569
const {
25722570
sessionId = this.state.session?.id,
25732571
userId = this.currentUserId,
25742572
userSessionId = this.unifiedSessionId,
2573+
kind = 'details',
25752574
} = opts;
25762575
// FIXME OL: not yet part of the API
25772576
if (!sessionId) return;
2577+
const base = `${this.streamClient.baseURL}/call_stats/${this.type}/${this.id}/${sessionId}`;
25782578
const endpoint =
25792579
userId && userSessionId
2580-
? `https://video-edge-frankfurt-ce1.stream-io-api.com/video/call_stats/${this.type}/${this.id}/${sessionId}/participant/${userId}/${userSessionId}/details`
2581-
: `https://video-edge-frankfurt-ce1.stream-io-api.com/video/call_stats/${this.type}/${this.id}/${sessionId}/participants`;
2580+
? kind === 'details'
2581+
? `${base}/participant/${userId}/${userSessionId}/details`
2582+
: `${base}/participants/${userId}/${userSessionId}/timeline`
2583+
: `${base}/participants`;
25822584
return this.streamClient.get(endpoint);
25832585
};
25842586

sample-apps/react/react-dogfood/components/DevMenu.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,21 @@ export const DevMenu = () => {
112112
{call && localParticipant && (
113113
<a
114114
className="rd__link rd__link--faux-button rd__link--align-left"
115-
href={`/stats/${call.cid}?user_id=${call.currentUserId}&user_session_id=${call['unifiedSessionId'] || localParticipant.sessionId}`}
115+
href={`/stats/${call.cid}?user_id=${call.currentUserId}&user_session_id=${call['unifiedSessionId'] || localParticipant.sessionId}&kind=details`}
116116
rel="noreferrer"
117117
target="_blank"
118118
>
119-
Go to {localParticipant?.name || 'User'} Stats
119+
Go to {localParticipant?.name || 'User'} Stats (Details)
120+
</a>
121+
)}
122+
{call && localParticipant && (
123+
<a
124+
className="rd__link rd__link--faux-button rd__link--align-left"
125+
href={`/stats/${call.cid}?user_id=${call.currentUserId}&user_session_id=${call['unifiedSessionId'] || localParticipant.sessionId}&kind=timeline`}
126+
rel="noreferrer"
127+
target="_blank"
128+
>
129+
Go to {localParticipant?.name || 'User'} Stats (Timeline)
120130
</a>
121131
)}
122132
</ul>

sample-apps/react/react-dogfood/pages/stats/[cid].tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ export default function Stats(props: ServerSideCredentialsProps) {
3636
const userSessionId = router.query['user_session_id'] as
3737
| string
3838
| undefined;
39+
const kind =
40+
(router.query['kind'] as 'details' | 'timeline') || 'details';
3941
const stats = await _call.getCallParticipantsStats({
4042
userId,
4143
userSessionId,
44+
kind,
4245
});
4346
console.log('Call participants stats:', stats);
4447
setData(stats);

0 commit comments

Comments
 (0)