fix(lab): запускать RAV004 с первого кадра

This commit is contained in:
DCCONSTRUCTIONS
2026-08-30 14:33:17 +03:00
parent 35daf73d5c
commit 9c5259dbc9
3 changed files with 152 additions and 1 deletions
@@ -196,6 +196,20 @@ export function isRecordedPlaybackFullyBuffered(
return recordedPlaybackBufferState(rangeNs, expectedTimelineEndSeconds).fullyBuffered;
}
export function shouldReapplyRecordedBlueprint(
recordingOpened: boolean,
recordedSource: boolean,
hasBlueprint: boolean,
identity: { applicationId: string; recordingId: string } | null,
event: { application_id: string; recording_id: string },
): boolean {
return recordingOpened
&& recordedSource
&& hasBlueprint
&& identity?.applicationId === event.application_id
&& identity.recordingId === event.recording_id;
}
export function attemptRecordedAutoplay(
seekToStart: () => void,
startPlaying: () => void,
@@ -209,6 +223,49 @@ export function attemptRecordedAutoplay(
}
}
export function createRecordedInitialSeekGate(): {
attempt: (
viewerStarted: boolean,
fullyBuffered: boolean,
presentationReady: boolean,
rangeNs: { min: number; max: number } | null,
seekToStart: (startNs: number) => void,
preferredStartNs?: number,
) => boolean;
attempted: () => boolean;
} {
let consumed = false;
return {
attempt(
viewerStarted,
fullyBuffered,
presentationReady,
rangeNs,
seekToStart,
preferredStartNs,
) {
if (
consumed
|| !viewerStarted
|| !fullyBuffered
|| !presentationReady
|| !isUsableRecordedPlaybackRange(rangeNs)
) return false;
consumed = true;
const startNs = Number.isFinite(preferredStartNs)
? Math.min(Math.max(preferredStartNs as number, rangeNs.min), rangeNs.max)
: rangeNs.min;
try {
seekToStart(startNs);
return true;
} catch {
return false;
}
},
attempted: () => consumed,
};
}
export function createRecordedAutoplayGate(): {
attempt: (
viewerStarted: boolean,