mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-28 16:55:36 +00:00
revert(recording): remove editor finalization phase
This commit is contained in:
Vendored
-4
@@ -75,10 +75,6 @@ interface Window {
|
||||
) => Promise<{ success: boolean; enabled: boolean }>;
|
||||
getSources: (opts: Electron.SourcesOptions) => Promise<ProcessedDesktopSource[]>;
|
||||
switchToEditor: () => Promise<void>;
|
||||
openEditorEarly: () => Promise<void>;
|
||||
isRecordingFinalizing: () => Promise<boolean>;
|
||||
notifyRecordingFinalized: () => Promise<void>;
|
||||
onRecordingFinalized: (callback: () => void) => () => void;
|
||||
openSourceSelector: () => Promise<void>;
|
||||
selectSource: (source: any) => Promise<any>;
|
||||
showSourceHighlight: (source: any) => Promise<{ success: boolean }>;
|
||||
|
||||
@@ -4102,12 +4102,8 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}
|
||||
}
|
||||
createSourceSelectorWindow()
|
||||
})
|
||||
|
||||
let recordingFinalizing = false
|
||||
|
||||
ipcMain.handle('switch-to-editor', () => {
|
||||
console.log('[switch-to-editor] Opening editor window')
|
||||
recordingFinalizing = false
|
||||
const sourceSelectorWin = getSourceSelectorWindow()
|
||||
if (sourceSelectorWin && !sourceSelectorWin.isDestroyed()) {
|
||||
sourceSelectorWin.close()
|
||||
@@ -4115,31 +4111,6 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}
|
||||
createEditorWindow()
|
||||
})
|
||||
|
||||
ipcMain.handle('open-editor-early', () => {
|
||||
console.log('[open-editor-early] Opening editor window while recording finalizes')
|
||||
recordingFinalizing = true
|
||||
const sourceSelectorWin = getSourceSelectorWindow()
|
||||
if (sourceSelectorWin && !sourceSelectorWin.isDestroyed()) {
|
||||
sourceSelectorWin.close()
|
||||
}
|
||||
createEditorWindow()
|
||||
})
|
||||
|
||||
ipcMain.handle('is-recording-finalizing', () => {
|
||||
return recordingFinalizing
|
||||
})
|
||||
|
||||
ipcMain.handle('notify-recording-finalized', () => {
|
||||
console.log('[notify-recording-finalized] Recording finalization complete')
|
||||
recordingFinalizing = false
|
||||
const allWindows = BrowserWindow.getAllWindows()
|
||||
for (const win of allWindows) {
|
||||
if (!win.isDestroyed()) {
|
||||
win.webContents.send('recording-finalized')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle('start-native-screen-recording', async (_, source: SelectedSource, options?: NativeMacRecordingOptions) => {
|
||||
// Windows native capture path
|
||||
if (process.platform === 'win32') {
|
||||
|
||||
@@ -167,20 +167,6 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
||||
switchToEditor: () => {
|
||||
return ipcRenderer.invoke("switch-to-editor");
|
||||
},
|
||||
openEditorEarly: () => {
|
||||
return ipcRenderer.invoke("open-editor-early");
|
||||
},
|
||||
isRecordingFinalizing: () => {
|
||||
return ipcRenderer.invoke("is-recording-finalizing") as Promise<boolean>;
|
||||
},
|
||||
notifyRecordingFinalized: () => {
|
||||
return ipcRenderer.invoke("notify-recording-finalized");
|
||||
},
|
||||
onRecordingFinalized: (callback: () => void) => {
|
||||
const listener = () => callback();
|
||||
ipcRenderer.on("recording-finalized", listener);
|
||||
return () => ipcRenderer.removeListener("recording-finalized", listener);
|
||||
},
|
||||
openSourceSelector: () => {
|
||||
return ipcRenderer.invoke("open-source-selector");
|
||||
},
|
||||
|
||||
@@ -453,7 +453,6 @@ export default function VideoEditor() {
|
||||
const [projectLibraryEntries, setProjectLibraryEntries] = useState<ProjectLibraryEntry[]>([]);
|
||||
const [projectBrowserOpen, setProjectBrowserOpen] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [recordingFinalizing, setRecordingFinalizing] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [currentTime, setCurrentTime] = useState(0);
|
||||
@@ -1523,7 +1522,6 @@ export default function VideoEditor() {
|
||||
|
||||
useEffect(() => {
|
||||
async function loadInitialData() {
|
||||
let waitingForFinalize = false;
|
||||
try {
|
||||
if (smokeExportConfig.enabled) {
|
||||
if (!smokeExportConfig.inputPath) {
|
||||
@@ -1601,76 +1599,17 @@ export default function VideoEditor() {
|
||||
sourcePath: null,
|
||||
}));
|
||||
} else {
|
||||
const finalizing = await window.electronAPI?.isRecordingFinalizing?.();
|
||||
if (finalizing) {
|
||||
waitingForFinalize = true;
|
||||
setRecordingFinalizing(true);
|
||||
return;
|
||||
}
|
||||
setError("No video to load. Please record or select a video.");
|
||||
}
|
||||
} catch (err) {
|
||||
setError("Error loading video: " + String(err));
|
||||
} finally {
|
||||
if (!waitingForFinalize) setLoading(false);
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Subscribe to the finalized event BEFORE loadInitialData checks
|
||||
// isRecordingFinalizing, so we never miss the event if it fires
|
||||
// between the check and the subscription.
|
||||
const cleanupFinalized = window.electronAPI?.onRecordingFinalized?.(() => {
|
||||
setRecordingFinalizing((wasFinalizing) => {
|
||||
if (!wasFinalizing) return false;
|
||||
setLoading(true);
|
||||
(async () => {
|
||||
try {
|
||||
const sessionResult = await window.electronAPI.getCurrentRecordingSession?.();
|
||||
if (sessionResult?.success && sessionResult.session?.videoPath) {
|
||||
const sourcePath = fromFileUrl(sessionResult.session.videoPath);
|
||||
const sourceVideoUrl = toFileUrl(sourcePath);
|
||||
setVideoSourcePath(sourcePath);
|
||||
setVideoPath(sourceVideoUrl);
|
||||
setCurrentProjectPath(null);
|
||||
setLastSavedSnapshot(null);
|
||||
pendingFreshRecordingAutoZoomPathRef.current = sourceVideoUrl;
|
||||
setWebcam((prev) => ({
|
||||
...prev,
|
||||
enabled: Boolean(sessionResult.session?.webcamPath),
|
||||
sourcePath: sessionResult.session?.webcamPath ?? null,
|
||||
}));
|
||||
} else {
|
||||
const result = await window.electronAPI.getCurrentVideoPath();
|
||||
if (result.success && result.path) {
|
||||
const sourcePath = fromFileUrl(result.path);
|
||||
const sourceVideoUrl = toFileUrl(sourcePath);
|
||||
setVideoSourcePath(sourcePath);
|
||||
setVideoPath(sourceVideoUrl);
|
||||
setCurrentProjectPath(null);
|
||||
setLastSavedSnapshot(null);
|
||||
pendingFreshRecordingAutoZoomPathRef.current = sourceVideoUrl;
|
||||
setWebcam((prev) => ({
|
||||
...prev,
|
||||
enabled: false,
|
||||
sourcePath: null,
|
||||
}));
|
||||
} else {
|
||||
setError("Recording finished but no video found.");
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
setError("Error loading video: " + String(err));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
})();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
loadInitialData();
|
||||
|
||||
return () => { cleanupFinalized?.(); };
|
||||
}, [applyLoadedProject, smokeExportConfig.enabled, smokeExportConfig.inputPath]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -3823,7 +3762,7 @@ export default function VideoEditor() {
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="flex h-screen items-center justify-center bg-background">
|
||||
<div className="text-foreground">{recordingFinalizing ? "Finalizing recording..." : "Loading video..."}</div>
|
||||
<div className="text-foreground">Loading video...</div>
|
||||
{projectBrowser}
|
||||
<Toaster theme="dark" className="pointer-events-auto" />
|
||||
</div>
|
||||
|
||||
@@ -371,7 +371,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
|
||||
}
|
||||
|
||||
clearRecordingFinalizationToast();
|
||||
await window.electronAPI.notifyRecordingFinalized();
|
||||
await window.electronAPI.switchToEditor();
|
||||
}, [clearRecordingFinalizationToast]);
|
||||
|
||||
const stopWebcamRecorder = useCallback(async () => {
|
||||
@@ -402,8 +402,6 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Open editor early so it shows "Finalizing recording..." while we finalize
|
||||
await window.electronAPI.openEditorEarly?.();
|
||||
const webcamPath = await stopWebcamRecorder();
|
||||
await finalizeRecordingSession(result.path, webcamPath);
|
||||
return result.path;
|
||||
@@ -561,11 +559,6 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
|
||||
|
||||
let finalPath = result.path;
|
||||
|
||||
// Open the editor window immediately so the user sees a
|
||||
// "Finalizing recording…" screen instead of staring at the
|
||||
// recorder UI while mux/IO completes.
|
||||
await window.electronAPI.openEditorEarly();
|
||||
|
||||
if (isNativeWindows) {
|
||||
const muxResult = await window.electronAPI.muxNativeWindowsRecording(pauseSegments);
|
||||
if (!muxResult?.success) {
|
||||
@@ -1019,9 +1012,6 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
|
||||
|
||||
showRecordingFinalizationToast();
|
||||
|
||||
// Open editor window immediately while we process the recording
|
||||
await window.electronAPI.openEditorEarly?.();
|
||||
|
||||
const duration = getRecordingDurationMs(Date.now());
|
||||
const recordedChunks = chunks.current;
|
||||
const buggyBlob = new Blob(recordedChunks, { type: mimeType });
|
||||
|
||||
Reference in New Issue
Block a user