Format rebased recording fallback changes

This commit is contained in:
webadderall
2026-04-24 11:20:31 +10:00
parent 6d8ab9df45
commit f026c1fa02
5 changed files with 1478 additions and 1209 deletions
+20 -16
View File
@@ -1,26 +1,26 @@
import { BrowserWindow } from "electron";
import { registerAssetHandlers } from "./register/assets";
import { registerCaptionHandlers } from "./register/captions";
import { registerExportHandlers } from "./register/export";
import { registerPermissionHandlers } from "./register/permissions";
import { registerProjectHandlers } from "./register/project";
import { registerRecordingHandlers } from "./register/recording";
import { registerSettingsHandlers } from "./register/settings";
import { registerSourceHandlers } from "./register/sources";
import {
windowsCaptureProcess,
setWindowsCaptureProcess,
setWindowsCaptureTargetPath,
setWindowsNativeCaptureActive,
selectedSource,
setNativeScreenRecordingActive,
setWindowsCaptureStopRequested,
setWindowsCapturePaused,
setWindowsSystemAudioPath,
setWindowsCaptureProcess,
setWindowsCaptureStopRequested,
setWindowsCaptureTargetPath,
setWindowsMicAudioPath,
setWindowsNativeCaptureActive,
setWindowsOrphanedMicAudioPath,
setWindowsPendingVideoPath,
selectedSource,
setWindowsSystemAudioPath,
windowsCaptureProcess,
} from "./state";
import { registerSourceHandlers } from "./register/sources";
import { registerRecordingHandlers } from "./register/recording";
import { registerPermissionHandlers } from "./register/permissions";
import { registerAssetHandlers } from "./register/assets";
import { registerExportHandlers } from "./register/export";
import { registerCaptionHandlers } from "./register/captions";
import { registerProjectHandlers } from "./register/project";
import { registerSettingsHandlers } from "./register/settings";
export { cleanupNativeVideoExportSessions } from "./export/native-video";
@@ -56,7 +56,11 @@ export function registerIpcHandlers(
getSourceSelectorWindow: () => BrowserWindow | null,
onRecordingStateChange?: (recording: boolean, sourceName: string) => void,
) {
registerSourceHandlers({ createEditorWindow, createSourceSelectorWindow, getSourceSelectorWindow });
registerSourceHandlers({
createEditorWindow,
createSourceSelectorWindow,
getSourceSelectorWindow,
});
registerRecordingHandlers(onRecordingStateChange);
registerPermissionHandlers();
registerAssetHandlers();
File diff suppressed because it is too large Load Diff
+168 -54
View File
@@ -91,7 +91,11 @@ export let cachedNativeMacWindowSources: import("./types").NativeMacWindowSource
export let cachedNativeMacWindowSourcesAtMs = 0;
// ── Native video export ───────────────────────────────────────────────────────
export let cachedNativeVideoEncoder: { ffmpegPath: string; encodingMode: string; encoderName: string } | null = null;
export let cachedNativeVideoEncoder: {
ffmpegPath: string;
encodingMode: string;
encoderName: string;
} | null = null;
// ── Native helper migration ───────────────────────────────────────────────────
export let nativeHelperMigrationPromise: Promise<void> | null = null;
@@ -103,69 +107,179 @@ export type { CursorInteractionType, CursorTelemetryPoint };
// TypeScript exported `let` can be reassigned by the owning module but importers
// cannot assign to them directly. Provide simple setters for cross-module writes.
export function setSelectedSource(v: SelectedSource | null) { selectedSource = v; }
export function setCurrentProjectPath(v: string | null) { currentProjectPath = v; }
export function setCurrentVideoPath(v: string | null) { currentVideoPath = v; }
export function setCurrentRecordingSession(v: RecordingSessionData | null) { currentRecordingSession = v; }
export function setSelectedSource(v: SelectedSource | null) {
selectedSource = v;
}
export function setCurrentProjectPath(v: string | null) {
currentProjectPath = v;
}
export function setCurrentVideoPath(v: string | null) {
currentVideoPath = v;
}
export function setCurrentRecordingSession(v: RecordingSessionData | null) {
currentRecordingSession = v;
}
export function setNativeScreenRecordingActive(v: boolean) { nativeScreenRecordingActive = v; }
export function setNativeCaptureProcess(v: ChildProcessWithoutNullStreams | null) { nativeCaptureProcess = v; }
export function setNativeCaptureOutputBuffer(v: string) { nativeCaptureOutputBuffer = v; }
export function setNativeCaptureTargetPath(v: string | null) { nativeCaptureTargetPath = v; }
export function setNativeCaptureStopRequested(v: boolean) { nativeCaptureStopRequested = v; }
export function setNativeCaptureSystemAudioPath(v: string | null) { nativeCaptureSystemAudioPath = v; }
export function setNativeCaptureMicrophonePath(v: string | null) { nativeCaptureMicrophonePath = v; }
export function setNativeCapturePaused(v: boolean) { nativeCapturePaused = v; }
export function setNativeScreenRecordingActive(v: boolean) {
nativeScreenRecordingActive = v;
}
export function setNativeCaptureProcess(v: ChildProcessWithoutNullStreams | null) {
nativeCaptureProcess = v;
}
export function setNativeCaptureOutputBuffer(v: string) {
nativeCaptureOutputBuffer = v;
}
export function setNativeCaptureTargetPath(v: string | null) {
nativeCaptureTargetPath = v;
}
export function setNativeCaptureStopRequested(v: boolean) {
nativeCaptureStopRequested = v;
}
export function setNativeCaptureSystemAudioPath(v: string | null) {
nativeCaptureSystemAudioPath = v;
}
export function setNativeCaptureMicrophonePath(v: string | null) {
nativeCaptureMicrophonePath = v;
}
export function setNativeCapturePaused(v: boolean) {
nativeCapturePaused = v;
}
export function setNativeCursorMonitorProcess(v: ChildProcessWithoutNullStreams | null) { nativeCursorMonitorProcess = v; }
export function setNativeCursorMonitorOutputBuffer(v: string) { nativeCursorMonitorOutputBuffer = v; }
export function setNativeCursorMonitorProcess(v: ChildProcessWithoutNullStreams | null) {
nativeCursorMonitorProcess = v;
}
export function setNativeCursorMonitorOutputBuffer(v: string) {
nativeCursorMonitorOutputBuffer = v;
}
export function setWindowsCaptureProcess(v: ChildProcessWithoutNullStreams | null) { windowsCaptureProcess = v; }
export function setWindowsCaptureOutputBuffer(v: string) { windowsCaptureOutputBuffer = v; }
export function setWindowsCaptureTargetPath(v: string | null) { windowsCaptureTargetPath = v; }
export function setWindowsNativeCaptureActive(v: boolean) { windowsNativeCaptureActive = v; }
export function setWindowsCaptureStopRequested(v: boolean) { windowsCaptureStopRequested = v; }
export function setWindowsCapturePaused(v: boolean) { windowsCapturePaused = v; }
export function setWindowsSystemAudioPath(v: string | null) { windowsSystemAudioPath = v; }
export function setWindowsMicAudioPath(v: string | null) { windowsMicAudioPath = v; }
export function setWindowsOrphanedMicAudioPath(v: string | null) { windowsOrphanedMicAudioPath = v; }
export function setWindowsPendingVideoPath(v: string | null) { windowsPendingVideoPath = v; }
export function setWindowsCaptureProcess(v: ChildProcessWithoutNullStreams | null) {
windowsCaptureProcess = v;
}
export function setWindowsCaptureOutputBuffer(v: string) {
windowsCaptureOutputBuffer = v;
}
export function setWindowsCaptureTargetPath(v: string | null) {
windowsCaptureTargetPath = v;
}
export function setWindowsNativeCaptureActive(v: boolean) {
windowsNativeCaptureActive = v;
}
export function setWindowsCaptureStopRequested(v: boolean) {
windowsCaptureStopRequested = v;
}
export function setWindowsCapturePaused(v: boolean) {
windowsCapturePaused = v;
}
export function setWindowsSystemAudioPath(v: string | null) {
windowsSystemAudioPath = v;
}
export function setWindowsMicAudioPath(v: string | null) {
windowsMicAudioPath = v;
}
export function setWindowsOrphanedMicAudioPath(v: string | null) {
windowsOrphanedMicAudioPath = v;
}
export function setWindowsPendingVideoPath(v: string | null) {
windowsPendingVideoPath = v;
}
export function setLastNativeCaptureDiagnostics(v: NativeCaptureDiagnostics | null) { lastNativeCaptureDiagnostics = v; }
export function setLastNativeCaptureDiagnostics(v: NativeCaptureDiagnostics | null) {
lastNativeCaptureDiagnostics = v;
}
export function setFfmpegScreenRecordingActive(v: boolean) { ffmpegScreenRecordingActive = v; }
export function setFfmpegCaptureProcess(v: ChildProcessWithoutNullStreams | null) { ffmpegCaptureProcess = v; }
export function setFfmpegCaptureOutputBuffer(v: string) { ffmpegCaptureOutputBuffer = v; }
export function setFfmpegCaptureTargetPath(v: string | null) { ffmpegCaptureTargetPath = v; }
export function setFfmpegScreenRecordingActive(v: boolean) {
ffmpegScreenRecordingActive = v;
}
export function setFfmpegCaptureProcess(v: ChildProcessWithoutNullStreams | null) {
ffmpegCaptureProcess = v;
}
export function setFfmpegCaptureOutputBuffer(v: string) {
ffmpegCaptureOutputBuffer = v;
}
export function setFfmpegCaptureTargetPath(v: string | null) {
ffmpegCaptureTargetPath = v;
}
export function setCustomRecordingsDir(v: string | null) { customRecordingsDir = v; }
export function setRecordingsDirLoaded(v: boolean) { recordingsDirLoaded = v; }
export function setCustomRecordingsDir(v: string | null) {
customRecordingsDir = v;
}
export function setRecordingsDirLoaded(v: boolean) {
recordingsDirLoaded = v;
}
export function setCachedSystemCursorAssets(v: Record<string, SystemCursorAsset> | null) { cachedSystemCursorAssets = v; }
export function setCachedSystemCursorAssetsSourceMtimeMs(v: number | null) { cachedSystemCursorAssetsSourceMtimeMs = v; }
export function setCachedSystemCursorAssets(v: Record<string, SystemCursorAsset> | null) {
cachedSystemCursorAssets = v;
}
export function setCachedSystemCursorAssetsSourceMtimeMs(v: number | null) {
cachedSystemCursorAssetsSourceMtimeMs = v;
}
export function setCountdownTimer(v: ReturnType<typeof setInterval> | null) { countdownTimer = v; }
export function setCountdownCancelled(v: boolean) { countdownCancelled = v; }
export function setCountdownInProgress(v: boolean) { countdownInProgress = v; }
export function setCountdownRemaining(v: number | null) { countdownRemaining = v; }
export function setCountdownTimer(v: ReturnType<typeof setInterval> | null) {
countdownTimer = v;
}
export function setCountdownCancelled(v: boolean) {
countdownCancelled = v;
}
export function setCountdownInProgress(v: boolean) {
countdownInProgress = v;
}
export function setCountdownRemaining(v: number | null) {
countdownRemaining = v;
}
export function setCurrentCursorVisualType(v: CursorVisualType | undefined) { currentCursorVisualType = v; }
export function setCurrentCursorVisualType(v: CursorVisualType | undefined) {
currentCursorVisualType = v;
}
export function setCursorCaptureInterval(v: NodeJS.Timeout | null) { cursorCaptureInterval = v; }
export function setCursorCaptureStartTimeMs(v: number) { cursorCaptureStartTimeMs = v; }
export function setActiveCursorSamples(v: CursorTelemetryPoint[]) { activeCursorSamples = v; }
export function setPendingCursorSamples(v: CursorTelemetryPoint[]) { pendingCursorSamples = v; }
export function setIsCursorCaptureActive(v: boolean) { isCursorCaptureActive = v; }
export function setInteractionCaptureCleanup(v: (() => void) | null) { interactionCaptureCleanup = v; }
export function setHasLoggedInteractionHookFailure(v: boolean) { hasLoggedInteractionHookFailure = v; }
export function setLastLeftClick(v: { timeMs: number; cx: number; cy: number } | null) { lastLeftClick = v; }
export function setLinuxCursorScreenPoint(v: { x: number; y: number; updatedAt: number } | null) { linuxCursorScreenPoint = v; }
export function setSelectedWindowBounds(v: WindowBounds | null) { selectedWindowBounds = v; }
export function setWindowBoundsCaptureInterval(v: NodeJS.Timeout | null) { windowBoundsCaptureInterval = v; }
export function setCursorCaptureInterval(v: NodeJS.Timeout | null) {
cursorCaptureInterval = v;
}
export function setCursorCaptureStartTimeMs(v: number) {
cursorCaptureStartTimeMs = v;
}
export function setActiveCursorSamples(v: CursorTelemetryPoint[]) {
activeCursorSamples = v;
}
export function setPendingCursorSamples(v: CursorTelemetryPoint[]) {
pendingCursorSamples = v;
}
export function setIsCursorCaptureActive(v: boolean) {
isCursorCaptureActive = v;
}
export function setInteractionCaptureCleanup(v: (() => void) | null) {
interactionCaptureCleanup = v;
}
export function setHasLoggedInteractionHookFailure(v: boolean) {
hasLoggedInteractionHookFailure = v;
}
export function setLastLeftClick(v: { timeMs: number; cx: number; cy: number } | null) {
lastLeftClick = v;
}
export function setLinuxCursorScreenPoint(v: { x: number; y: number; updatedAt: number } | null) {
linuxCursorScreenPoint = v;
}
export function setSelectedWindowBounds(v: WindowBounds | null) {
selectedWindowBounds = v;
}
export function setWindowBoundsCaptureInterval(v: NodeJS.Timeout | null) {
windowBoundsCaptureInterval = v;
}
export function setCachedNativeMacWindowSources(v: import("./types").NativeMacWindowSource[] | null) { cachedNativeMacWindowSources = v; }
export function setCachedNativeMacWindowSourcesAtMs(v: number) { cachedNativeMacWindowSourcesAtMs = v; }
export function setCachedNativeMacWindowSources(
v: import("./types").NativeMacWindowSource[] | null,
) {
cachedNativeMacWindowSources = v;
}
export function setCachedNativeMacWindowSourcesAtMs(v: number) {
cachedNativeMacWindowSourcesAtMs = v;
}
export function setCachedNativeVideoEncoder(v: { ffmpegPath: string; encodingMode: string; encoderName: string } | null) { cachedNativeVideoEncoder = v; }
export function setCachedNativeVideoEncoder(
v: { ffmpegPath: string; encodingMode: string; encoderName: string } | null,
) {
cachedNativeVideoEncoder = v;
}
export function setNativeHelperMigrationPromise(v: Promise<void> | null) { nativeHelperMigrationPromise = v; }
export function setNativeHelperMigrationPromise(v: Promise<void> | null) {
nativeHelperMigrationPromise = v;
}
+4 -1
View File
@@ -480,7 +480,10 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
try {
const arrayBuffer = await micFallbackBlob.arrayBuffer();
const result = await window.electronAPI.storeMicrophoneSidecar(arrayBuffer, finalPath);
const result = await window.electronAPI.storeMicrophoneSidecar(
arrayBuffer,
finalPath,
);
if (!result.success) {
const errorMessage =
result.error || "Failed to save the fallback microphone audio track";
+1 -4
View File
@@ -22,10 +22,7 @@ describe("resolveSourceAudioFallbackPaths", () => {
]),
).toEqual({
hasEmbeddedSourceAudio: false,
externalAudioPaths: [
"/tmp/recording.system.wav",
"/tmp/recording.mic.wav",
],
externalAudioPaths: ["/tmp/recording.system.wav", "/tmp/recording.mic.wav"],
});
});