mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-05 10:14:30 +00:00
fix(studio): preserve playhead position on composition refresh
Stop NLEPreview from including refreshKey in the Player's React key. Previously, a refreshKey change caused a full Player teardown + remount, which destroyed the playback adapter before refreshPlayer() could save the seek position — so the playhead always reset to 0:00. Now refreshKey changes only trigger refreshPlayer()'s lightweight iframe.src reload path, which correctly captures the current time via saveSeekPosition() before reloading the iframe content. Closes #996
This commit is contained in:
@@ -95,7 +95,6 @@ export const NLEPreview = memo(function NLEPreview({
|
||||
suppressLoadingOverlay,
|
||||
}: NLEPreviewProps) {
|
||||
const baseKey = getPreviewPlayerKey({ projectId, directUrl, refreshKey });
|
||||
const prevRefreshKeyRef = useRef(refreshKey);
|
||||
const viewportRef = useRef<HTMLDivElement>(null);
|
||||
const stageRef = useRef<HTMLDivElement>(null);
|
||||
const [retiringKey, setRetiringKey] = useState<string | null>(null);
|
||||
@@ -205,13 +204,7 @@ export const NLEPreview = memo(function NLEPreview({
|
||||
[applyTransform],
|
||||
);
|
||||
|
||||
if (refreshKey !== prevRefreshKeyRef.current) {
|
||||
const oldKey = `${baseKey}:${prevRefreshKeyRef.current ?? 0}`;
|
||||
prevRefreshKeyRef.current = refreshKey;
|
||||
setRetiringKey(oldKey);
|
||||
}
|
||||
|
||||
const activeKey = `${baseKey}:${refreshKey ?? 0}`;
|
||||
const activeKey = baseKey;
|
||||
|
||||
const applyInitialZoom = useCallback(() => {
|
||||
const z = zoomRef.current;
|
||||
|
||||
Reference in New Issue
Block a user