mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-08 02:36:10 +00:00
refactor(studio): reuse player probe errors
This commit is contained in:
@@ -32,7 +32,7 @@ export interface NLEContextValue {
|
||||
togglePlay: () => void;
|
||||
seek: (time: number, options?: { keepPlaying?: boolean }) => boolean;
|
||||
refreshPlayer: () => void;
|
||||
onIframeLoad: (reportError?: (message: string) => void) => void;
|
||||
onIframeLoad: () => void;
|
||||
// composition stack (from useCompositionStack)
|
||||
compositionStack: CompositionLevel[];
|
||||
updateCompositionStack: React.Dispatch<React.SetStateAction<CompositionLevel[]>>;
|
||||
@@ -122,17 +122,14 @@ export function NLEProvider({
|
||||
refreshPlayer();
|
||||
}, [refreshKey, refreshPlayer]);
|
||||
|
||||
const onIframeLoad = useCallback(
|
||||
(reportError?: (message: string) => void) => {
|
||||
baseOnIframeLoad(reportError);
|
||||
// Pre-load + register MotionPathPlugin once so adding a motion path in the
|
||||
// studio doesn't take the async plugin-load flash path on the first soft
|
||||
// reload (the comp may not ship the plugin until it actually uses one).
|
||||
ensureMotionPathPluginLoaded(iframeRef.current);
|
||||
onIframeRef?.(iframeRef.current);
|
||||
},
|
||||
[baseOnIframeLoad, iframeRef, onIframeRef],
|
||||
);
|
||||
const onIframeLoad = useCallback(() => {
|
||||
baseOnIframeLoad();
|
||||
// Pre-load + register MotionPathPlugin once so adding a motion path in the
|
||||
// studio doesn't take the async plugin-load flash path on the first soft
|
||||
// reload (the comp may not ship the plugin until it actually uses one).
|
||||
ensureMotionPathPluginLoaded(iframeRef.current);
|
||||
onIframeRef?.(iframeRef.current);
|
||||
}, [baseOnIframeLoad, iframeRef, onIframeRef]);
|
||||
|
||||
const {
|
||||
compositionStack,
|
||||
|
||||
@@ -15,7 +15,7 @@ import { readStudioUiPreferences, writeStudioUiPreferences } from "../../utils/s
|
||||
interface NLEPreviewProps {
|
||||
projectId: string;
|
||||
iframeRef: RefObject<HTMLIFrameElement | null>;
|
||||
onIframeLoad: (reportError?: (message: string) => void) => void;
|
||||
onIframeLoad: () => void;
|
||||
onCompositionLoadingChange?: (loading: boolean) => void;
|
||||
portrait?: boolean;
|
||||
directUrl?: string;
|
||||
@@ -491,9 +491,9 @@ export const NLEPreview = memo(function NLEPreview({
|
||||
ref={setPreviewIframeRef}
|
||||
projectId={directUrl ? undefined : projectId}
|
||||
directUrl={directUrl}
|
||||
onLoad={(reportError) => {
|
||||
onLoad={() => {
|
||||
updateCompositionSizeFromPreview();
|
||||
onIframeLoad(reportError);
|
||||
onIframeLoad();
|
||||
applyInitialZoom();
|
||||
}}
|
||||
onCompositionLoadingChange={onCompositionLoadingChange}
|
||||
|
||||
Reference in New Issue
Block a user