feat(voice): record watch failures and decode counters (#2666)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-11 13:05:34 +02:00
1 parent 320949a79d
commit 88a5ff9c45
10 files changed
+917 -3

No files matched your search

@@ -8,6 +8,7 @@ import {
type ScreenShareWatchFailure,
ScreenShareWatchFailures,
} from '@app/features/voice/state/ScreenShareWatchFailures';
import type {RemoteTrackPublication} from 'livekit-client';
import type React from 'react';
import {useEffect, useMemo} from 'react';
@@ -23,6 +24,7 @@ interface UseScreenShareWatchFailureOptions {
isPublicationDesired: boolean;
hasSubscribedVideo: boolean;
operationKey?: string | number | null;
publication?: RemoteTrackPublication | null;
videoRef: React.RefObject<HTMLVideoElement | null>;
}
@@ -69,6 +71,7 @@ export function useScreenShareWatchFailure({
participantSid,
trackSid,
operationKey,
publication,
videoRef,
}: UseScreenShareWatchFailureOptions): ScreenShareWatchFailureState {
const attemptEnabled = enabled && streamKey !== '';
@@ -101,6 +104,14 @@ export function useScreenShareWatchFailure({
};
}, [attemptEnabled, attemptKey, target]);
useEffect(() => {
if (!attemptEnabled) return;
ScreenShareWatchFailures.setWatchTarget(streamKey, {videoRef, publication});
return () => {
ScreenShareWatchFailures.clearWatchTarget(streamKey);
};
}, [attemptEnabled, publication, streamKey, videoRef]);
useEffect(() => {
if (!attemptEnabled || !attemptKey) return;
if (isOperationBuffering) return;