mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 13:35:42 +09:00
fix(voice): key watch attempts by published track (#2681)
This commit is contained in:
1 parent
67e01be34a
commit
53b3fa2f4a
4 files changed
+319
-10
No files matched your search
@@ -13,6 +13,7 @@ import type React from 'react';
|
||||
import {useEffect, useMemo} from 'react';
|
||||
|
||||
const SCREEN_SHARE_SOURCE = 'screen_share';
|
||||
const MISSING_TRACK_SID = 'no-track';
|
||||
|
||||
interface UseScreenShareWatchFailureOptions {
|
||||
enabled: boolean;
|
||||
@@ -64,6 +65,26 @@ function createFailureTarget({
|
||||
return target;
|
||||
}
|
||||
|
||||
interface ScreenShareWatchAttemptKeyOptions {
|
||||
streamKey: string;
|
||||
watchGeneration: number;
|
||||
trackSid?: string | null;
|
||||
operationKey?: string | number | null;
|
||||
}
|
||||
|
||||
export function screenShareWatchAttemptKey({
|
||||
streamKey,
|
||||
watchGeneration,
|
||||
trackSid,
|
||||
operationKey,
|
||||
}: ScreenShareWatchAttemptKeyOptions): string {
|
||||
if (!streamKey) return '';
|
||||
const track = trackSid || MISSING_TRACK_SID;
|
||||
return operationKey == null
|
||||
? `${streamKey}:${watchGeneration}:${track}:watch`
|
||||
: `${streamKey}:${watchGeneration}:${track}:operation:${operationKey}`;
|
||||
}
|
||||
|
||||
export function useScreenShareWatchFailure({
|
||||
enabled,
|
||||
streamKey,
|
||||
@@ -87,9 +108,7 @@ export function useScreenShareWatchFailure({
|
||||
);
|
||||
const watchGeneration = attemptEnabled ? ScreenShareWatchFailures.getWatchGeneration(streamKey) : 0;
|
||||
const attemptKey = attemptEnabled
|
||||
? operationKey == null
|
||||
? `${streamKey}:${watchGeneration}:watch`
|
||||
: `${streamKey}:${watchGeneration}:operation:${operationKey}`
|
||||
? screenShareWatchAttemptKey({streamKey, watchGeneration, trackSid, operationKey})
|
||||
: '';
|
||||
const isOperationBuffering = operationKey != null;
|
||||
const failure = attemptEnabled ? ScreenShareWatchFailures.getFailure(target) : null;
|
||||
|
||||
Reference in new issue
Block a user