Skip to content

Commit

Permalink
Send a dummy insightsStats event to rtc stats
Browse files Browse the repository at this point in the history
  • Loading branch information
thyal committed Jan 17, 2024
1 parent 816d532 commit 1ec170d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/core/redux/slices/rtcAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ export const doRtcAnalyticsCustomEventsInitialize = createAppThunk(() => (dispat

if (!rtcManager) return;

// RTC stats require a `insightsStats` event to be sent to set the timestamp.
// This is a temporary workaround, we just send one dummy event on initialization.
rtcManager.sendStatsCustomEvent("insightsStats", {
_time: Date.now(),
ls: 0,
lr: 0,
bs: 0,
br: 0,
cpu: 0,
});

Object.values(rtcAnalyticsCustomEvents).forEach(({ rtcEventName, getValue, getOutput }) => {
const value = getValue(state);
const output = { ...(getOutput(value) as Record<string, unknown>), _time: Date.now() };
Expand Down

0 comments on commit 1ec170d

Please sign in to comment.