Create polished demo videos without editing skills. Mac/Windows/Linux
Merge fix/wgc-display-webcam-sync into main
webadderall2363ae87bd99
diff --cc electron/ipc/handlers.tsindex 0a3d6d8c,2564aad6..e422fc47--- a/electron/ipc/handlers.ts+++ b/electron/ipc/handlers.ts@@@ -84,20 -61,12 +85,21 @@@ type RecordingSessionData =}type RecordingSessionManifest = {- version: 1+ version: 1 | 2videoFileName: stringwebcamFileName?: string | null+ timeOffsetMs?: number}+type ProjectLibraryEntry = {+ path: string+ name: string+ updatedAt: number+ thumbnailPath: string | null+ isCurrent: boolean+ isInProjectsDirectory: boolean+}+let selectedSource: SelectedSource | null = nulllet currentProjectPath: string | null = nulllet nativeScreenRecordingActive = false@@@ -246,154 -204,6 +248,155 @@@ async function persistRecordingsDirecto)}+function hasProjectFileExtension(filePath: string) {+ const extension = path.extname(filePath).replace(/^\./, '').toLowerCase()+ return [PROJECT_FILE_EXTENSION, ...LEGACY_PROJECT_FILE_EXTENSIONS].includes(extension)+}++function getProjectThumbnailPath(projectPath: string) {+ return `${projectPath}${PROJECT_THUMBNAIL_SUFFIX}`+}++async function saveProjectThumbnail(projectPath: string, thumbnailDataUrl?: string | null) {+ const thumbnailPath = getProjectThumbnailPath(projectPath)+ if (!thumbnailDataUrl) {+ await fs.rm(thumbnailPath, { force: true }).catch(() => undefined)+ return null+ }++ const match = thumbnailDataUrl.match(/^data:image\/png;base64,(.+)$/)+ if (!match) {+ throw new Error('Project thumbnail must be a PNG data URL.')+ }++ await fs.writeFile(thumbnailPath, Buffer.from(match[1], 'base64'))+ return thumbnailPath+}++async function loadRecentProjectPaths() {+ try {+ const content = await fs.readFile(RECENT_PROJECTS_FILE, 'utf-8')+ const parsed = JSON.parse(content) as { paths?: unknown }+ return Array.isArray(parsed.paths)+ ? parsed.paths.filter((value): value is string => typeof value === 'string' && value.trim().length > 0)+ : []+ } catch {+ return []+ }+}++async function saveRecentProjectPaths(paths: string[]) {+ const normalizedPaths = Array.from(new Set(paths.map((value) => normalizePath(value)))).slice(0, MAX_RECENT_PROJECTS)+ await fs.writeFile(+ RECENT_PROJECTS_FILE,+ JSON.stringify({ paths: normalizedPaths }, null, 2),+ 'utf-8',+ )+}++async function rememberRecentProject(projectPath: string) {+ if (!hasProjectFileExtension(projectPath)) {+ return+ }++ const existingPaths = await loadRecentProjectPaths()+ await saveRecentProjectPaths([projectPath, ...existingPaths])+}++async function buildProjectLibraryEntry(projectPath: string, projectsDir: string): Promise<ProjectLibraryEntry | null> {+ try {+ const normalizedPath = normalizePath(projectPath)+ if (!hasProjectFileExtension(normalizedPath)) {+ return null+ }++ const stats = await fs.stat(normalizedPath)+ if (!stats.isFile()) {+ return null+ }++ const thumbnailPath = getProjectThumbnailPath(normalizedPath)+ const thumbnailExists = await fs.access(thumbnailPath, fsConstants.R_OK)+ .then(() => true)+ .catch(() => false)++ return {+ path: normalizedPath,+ name: path.basename(normalizedPath).replace(/\.(recordly|openscreen)$/i, ''),+ updatedAt: stats.mtimeMs,+ thumbnailPath: thumbnailExists ? thumbnailPath : null,+ isCurrent: Boolean(currentProjectPath && normalizePath(currentProjectPath) === normalizedPath),+ isInProjectsDirectory: path.dirname(normalizedPath) === normalizePath(projectsDir),+ }+ } catch {+ return null+ }+}++async function listProjectLibraryEntries() {+ const projectsDir = await getProjectsDir()+ const projectPaths: string[] = []++ try {+ const entries = await fs.readdir(projectsDir, { withFileTypes: true })+ for (const entry of entries) {+ if (!entry.isFile()) {+ continue+ }++ const entryPath = path.join(projectsDir, entry.name)+ if (hasProjectFileExtension(entryPath)) {+ projectPaths.push(entryPath)+ }+ }+ } catch {+ // Ignore directory read failures and fall back to recent files.+ }++ const recentProjectPaths = await loadRecentProjectPaths()+ const candidatePaths = Array.from(new Set([...projectPaths, ...recentProjectPaths]))+ const entries = (await Promise.all(candidatePaths.map((candidatePath) => buildProjectLibraryEntry(candidatePath, projectsDir))))+ .filter((entry): entry is ProjectLibraryEntry => entry != null)+ .sort((left, right) => right.updatedAt - left.updatedAt)++ await saveRecentProjectPaths(entries.map((entry) => entry.path))++ return {+ projectsDir,+ entries,+ }+}++async function loadProjectFromPath(projectPath: string) {+ const normalizedPath = normalizePath(projectPath)+ const content = await fs.readFile(normalizedPath, 'utf-8')+ const project = JSON.parse(content)+ const mediaSources = await resolveProjectMediaSources(project)++ if (!mediaSources.success) {+ return {+ success: false,+ canceled: false,+ message: mediaSources.message,+ }+ }++ currentProjectPath = normalizedPath+ currentVideoPath = mediaSources.videoPath+ currentRecordingSession = {+ videoPath: mediaSources.videoPath,+ webcamPath: mediaSources.webcamPath,++ timeOffsetMs: mediaSources.timeOffsetMs,+ }+ await rememberRecentProject(normalizedPath)++ return {+ success: true,+ path: normalizedPath,+ project,+ }+}+function normalizeVideoSourcePath(videoPath?: string | null): string | null {if (typeof videoPath !== 'string') {return null@@@ -415,70 -225,12 +418,83 @@@return trimmed}+async function resolveProjectMediaSources(project: unknown): Promise<+ | {+ success: true+ videoPath: string+ webcamPath: string | null++ timeOffsetMs: number+ }+ | {+ success: false+ message: string+ }+> {+ if (!project || typeof project !== 'object') {+ return { success: false, message: 'Invalid project file format' }+ }++ const rawVideoPath = (project as { videoPath?: unknown }).videoPath+ if (typeof rawVideoPath !== 'string') {+ return { success: false, message: 'Project file is missing a video path' }+ }++ const normalizedVideoPath = normalizeVideoSourcePath(rawVideoPath)+ if (!normalizedVideoPath) {+ return { success: false, message: 'Project file is missing a valid video path' }+ }++ try {+ await fs.access(normalizedVideoPath, fsConstants.F_OK)+ } catch {+ return {+ success: false,+ message: `Project video file not found: ${normalizedVideoPath}`,+ }+ }++ const rawWebcamPath =+ typeof (project as { editor?: { webcam?: { sourcePath?: unknown } } }).editor?.webcam?.sourcePath === 'string'+ ? ((project as { editor?: { webcam?: { sourcePath?: string } } }).editor?.webcam?.sourcePath ?? null)+ : null++ const timeOffsetMs = normalizeRecordingTimeOffsetMs(++ (project as { editor?: { webcam?: { timeOffsetMs?: unknown } } }).editor?.webcam?.timeOffsetMs,++ )+ const normalizedWebcamPath = normalizeVideoSourcePath(rawWebcamPath)++ if (!normalizedWebcamPath) {+ return {+ success: true,+ videoPath: normalizedVideoPath,+ webcamPath: null,++ timeOffsetMs,+ }+ }++ try {+ await fs.access(normalizedWebcamPath, fsConstants.F_OK)+ return {+ success: true,+ videoPath: normalizedVideoPath,+ webcamPath: normalizedWebcamPath,++ timeOffsetMs,+ }+ } catch {+ return {+ success: true,+ videoPath: normalizedVideoPath,+ webcamPath: null,++ timeOffsetMs,+ }+ }+}++ function normalizeRecordingTimeOffsetMs(value: unknown): number {+ return typeof value === 'number' && Number.isFinite(value)+ ? Math.round(value)+ : 0+ }+function getRecordingSessionManifestPath(videoPath: string) {const extension = path.extname(videoPath)const baseName = path.basename(videoPath, extension)diff --cc src/components/video-editor/VideoEditor.tsxindex dc11eec5,e614a74b..77da916d--- a/src/components/video-editor/VideoEditor.tsx+++ b/src/components/video-editor/VideoEditor.tsx@@@ -1045,162 -300,175 +1045,163 @@@ export default function VideoEditor()historyPastRef.current.push(cloneSnapshot(current));historyCurrentRef.current = cloneSnapshot(next);applyHistorySnapshot(next);- }, [applyHistorySnapshot, buildHistorySnapshot, cloneSnapshot]);+ syncHistoryButtons();+ }, [applyHistorySnapshot, buildHistorySnapshot, cloneSnapshot, syncHistoryButtons]);- const applyLoadedProject = useCallback(async (candidate: unknown, path?: string | null) => {- if (!validateProjectData(candidate)) {- return false;- }+ const applyLoadedProject = useCallback(+ async (candidate: unknown, path?: string | null) => {+ if (!validateProjectData(candidate)) {+ return false;+ }- const project = candidate;- const sourcePath = fromFileUrl(project.videoPath);- const normalizedEditor = normalizeProjectEditor(project.editor);+ const project = candidate;+ const sourcePath = fromFileUrl(project.videoPath);+ const normalizedEditor = normalizeProjectEditor(project.editor);- try {- videoPlaybackRef.current?.pause();- } catch {- // no-op- }- setIsPlaying(false);- setCurrentTime(0);- setDuration(0);-- setError(null);- setVideoSourcePath(sourcePath);- setVideoPath(toFileUrl(sourcePath));- setCurrentProjectPath(path ?? null);-- setWallpaper(normalizedEditor.wallpaper);- setShadowIntensity(normalizedEditor.shadowIntensity);- setBackgroundBlur(normalizedEditor.backgroundBlur);- setZoomMotionBlur(normalizedEditor.zoomMotionBlur);- setConnectZooms(normalizedEditor.connectZooms);- setShowCursor(normalizedEditor.showCursor);- setLoopCursor(normalizedEditor.loopCursor);- setCursorSize(normalizedEditor.cursorSize);- setCursorSmoothing(normalizedEditor.cursorSmoothing);- setCursorMotionBlur(normalizedEditor.cursorMotionBlur);- setCursorClickBounce(normalizedEditor.cursorClickBounce);- setCursorSway(normalizedEditor.cursorSway);- setBorderRadius(normalizedEditor.borderRadius);- setPadding(normalizedEditor.padding);- setCropRegion(normalizedEditor.cropRegion);- setWebcam(normalizedEditor.webcam);- setZoomRegions(normalizedEditor.zoomRegions);- setTrimRegions(normalizedEditor.trimRegions);- setSpeedRegions(normalizedEditor.speedRegions);- setAnnotationRegions(normalizedEditor.annotationRegions);- setAudioRegions(normalizedEditor.audioRegions);- setAspectRatio(normalizedEditor.aspectRatio);- setExportQuality(normalizedEditor.exportQuality);- setExportFormat(normalizedEditor.exportFormat);- setGifFrameRate(normalizedEditor.gifFrameRate);- setGifLoop(normalizedEditor.gifLoop);- setGifSizePreset(normalizedEditor.gifSizePreset);+ try {+ videoPlaybackRef.current?.pause();+ } catch {+ // no-op+ }+ setIsPlaying(false);+ setCurrentTime(0);+ setDuration(0);++ setError(null);+ setVideoSourcePath(sourcePath);+ setVideoPath(toFileUrl(sourcePath));+ setCurrentProjectPath(path ?? null);+ if (normalizedEditor.webcam.sourcePath) {+ await window.electronAPI.setCurrentRecordingSession?.({+ videoPath: sourcePath,+ webcamPath: normalizedEditor.webcam.sourcePath,+ });+ } else {+ await window.electronAPI.setCurrentVideoPath(sourcePath);+ }- setSelectedZoomId(null);- setSelectedTrimId(null);- setSelectedSpeedId(null);- setSelectedAnnotationId(null);- setSelectedAudioId(null);+ setWallpaper(normalizedEditor.wallpaper);+ setShadowIntensity(normalizedEditor.shadowIntensity);+ setBackgroundBlur(normalizedEditor.backgroundBlur);+ setZoomMotionBlur(normalizedEditor.zoomMotionBlur);+ setConnectZooms(normalizedEditor.connectZooms);+ setZoomInDurationMs(normalizedEditor.zoomInDurationMs);+ setZoomInOverlapMs(normalizedEditor.zoomInOverlapMs);+ setZoomOutDurationMs(normalizedEditor.zoomOutDurationMs);+ setConnectedZoomGapMs(normalizedEditor.connectedZoomGapMs);+ setConnectedZoomDurationMs(normalizedEditor.connectedZoomDurationMs);+ setZoomInEasing(normalizedEditor.zoomInEasing);+ setZoomOutEasing(normalizedEditor.zoomOutEasing);+ setConnectedZoomEasing(normalizedEditor.connectedZoomEasing);+ setShowCursor(normalizedEditor.showCursor);+ setLoopCursor(normalizedEditor.loopCursor);+ setCursorStyle(normalizedEditor.cursorStyle);+ setCursorSize(normalizedEditor.cursorSize);+ setCursorSmoothing(normalizedEditor.cursorSmoothing);+ setCursorMotionBlur(normalizedEditor.cursorMotionBlur);+ setCursorClickBounce(normalizedEditor.cursorClickBounce);+ setCursorClickBounceDuration(normalizedEditor.cursorClickBounceDuration);+ setCursorSway(normalizedEditor.cursorSway);+ setBorderRadius(normalizedEditor.borderRadius);+ setPadding(normalizedEditor.padding);+ setCropRegion(DEFAULT_CROP_REGION);+ setWebcam(normalizedEditor.webcam);+ setZoomRegions(normalizedEditor.zoomRegions);+ setTrimRegions(normalizedEditor.trimRegions);+ setSpeedRegions(normalizedEditor.speedRegions);+ setAnnotationRegions(normalizedEditor.annotationRegions);+ setAudioRegions(normalizedEditor.audioRegions);+ setAutoCaptions(normalizedEditor.autoCaptions);+ setAutoCaptionSettings(normalizedEditor.autoCaptionSettings);+ setAspectRatio(normalizedEditor.aspectRatio);+ setExportQuality(normalizedEditor.exportQuality);+ setExportFormat(normalizedEditor.exportFormat);+ setGifFrameRate(normalizedEditor.gifFrameRate);+ setGifLoop(normalizedEditor.gifLoop);+ setGifSizePreset(normalizedEditor.gifSizePreset);- nextZoomIdRef.current = deriveNextId(- "zoom",- normalizedEditor.zoomRegions.map((region) => region.id),- );- nextTrimIdRef.current = deriveNextId(- "trim",- normalizedEditor.trimRegions.map((region) => region.id),- );- nextSpeedIdRef.current = deriveNextId(- "speed",- normalizedEditor.speedRegions.map((region) => region.id),- );- nextAudioIdRef.current = deriveNextId(- "audio",- normalizedEditor.audioRegions.map((region) => region.id),- );- nextAnnotationIdRef.current = deriveNextId(- "annotation",- normalizedEditor.annotationRegions.map((region) => region.id),- );- nextAnnotationZIndexRef.current =- normalizedEditor.annotationRegions.reduce((max, region) => Math.max(max, region.zIndex), 0) +- 1;+ setSelectedZoomId(null);+ setSelectedTrimId(null);+ setSelectedSpeedId(null);+ setSelectedAnnotationId(null);+ setSelectedAudioId(null);- setLastSavedSnapshot(JSON.stringify(createProjectData(sourcePath, normalizedEditor)));- return true;- }, []);+ nextZoomIdRef.current = deriveNextId(+ "zoom",+ normalizedEditor.zoomRegions.map((region) => region.id),+ );+ nextTrimIdRef.current = deriveNextId(+ "trim",+ normalizedEditor.trimRegions.map((region) => region.id),+ );+ nextSpeedIdRef.current = deriveNextId(+ "speed",+ normalizedEditor.speedRegions.map((region) => region.id),+ );+ nextAudioIdRef.current = deriveNextId(+ "audio",+ normalizedEditor.audioRegions.map((region) => region.id),+ );+ nextAnnotationIdRef.current = deriveNextId(+ "annotation",+ normalizedEditor.annotationRegions.map((region) => region.id),+ );+ nextAnnotationZIndexRef.current =+ normalizedEditor.annotationRegions.reduce(+ (max, region) => Math.max(max, region.zIndex),+ 0,+ ) + 1;++ historyPastRef.current = [];+ historyFutureRef.current = [];+ historyCurrentRef.current = null;+ applyingHistoryRef.current = false;+ syncHistoryButtons();++ setLastSavedSnapshot(+ cloneStructured(createProjectData(sourcePath, buildPersistedEditorState(normalizedEditor))),+ );+ await refreshProjectLibrary();+ return true;+ },+ [buildPersistedEditorState, refreshProjectLibrary, syncHistoryButtons],+ );const currentProjectSnapshot = useMemo(() => {- const sourcePath = videoSourcePath ?? (videoPath ? fromFileUrl(videoPath) : null);- if (!sourcePath) {+ if (!currentSourcePath) {return null;}- return JSON.stringify(- createProjectData(sourcePath, {- wallpaper,- shadowIntensity,- backgroundBlur,- zoomMotionBlur,- connectZooms,- showCursor,- loopCursor,- cursorSize,- cursorSmoothing,- cursorMotionBlur,- cursorClickBounce,- cursorSway,- borderRadius,- padding,- cropRegion,- webcam,- zoomRegions,- trimRegions,- speedRegions,- annotationRegions,- audioRegions,- aspectRatio,- exportQuality,- exportFormat,- gifFrameRate,- gifLoop,- gifSizePreset,- }),- );- }, [- videoPath,- videoSourcePath,- wallpaper,- shadowIntensity,- backgroundBlur,- zoomMotionBlur,- connectZooms,- showCursor,- loopCursor,- cursorSize,- cursorSmoothing,- cursorMotionBlur,- cursorClickBounce,- cursorSway,- borderRadius,- padding,- cropRegion,- webcam,- zoomRegions,- trimRegions,- speedRegions,- audioRegions,- annotationRegions,- aspectRatio,- exportQuality,- exportFormat,- gifFrameRate,- gifLoop,- gifSizePreset,- ]);+ return createProjectData(currentSourcePath, currentPersistedEditorState);+ }, [currentPersistedEditorState, currentSourcePath]);const syncRecordingSessionWebcam = useCallback(- async (webcamPath: string | null) => {+ async (webcamPath: string | null, timeOffsetMs = 0) => {- const sourcePath = videoSourcePath ?? (videoPath ? fromFileUrl(videoPath) : null);- if (!sourcePath || !window.electronAPI.setCurrentRecordingSession) {+ if (!currentSourcePath || !window.electronAPI.setCurrentRecordingSession) {return;}await window.electronAPI.setCurrentRecordingSession({- videoPath: sourcePath,+ videoPath: currentSourcePath,webcamPath,+ timeOffsetMs,});},- [videoPath, videoSourcePath],+ [currentSourcePath],+ );++ const syncActiveVideoSource = useCallback(+ async (sourcePath: string, webcamPath?: string | null) => {+ if (webcamPath) {+ await window.electronAPI.setCurrentRecordingSession?.({+ videoPath: sourcePath,+ webcamPath,+ });+ return;+ }++ await window.electronAPI.setCurrentVideoPath(sourcePath);+ },+ [],);const handleUploadWebcam = useCallback(async () => {diff --cc src/components/video-editor/VideoPlayback.tsxindex 0e8fe195,b3ce2dca..6ba75ac0--- a/src/components/video-editor/VideoPlayback.tsx+++ b/src/components/video-editor/VideoPlayback.tsx@@@ -944,26 -706,13 +944,26 @@@ const VideoPlayback = forwardRef<VideoPreturn;}- const targetTime = Math.max(0, currentTime - (webcam.timeOffsetMs ?? 0) / 1000);- const clampedTargetTime = Number.isFinite(webcamVideo.duration)- ? Math.min(targetTime, Math.max(0, webcamVideo.duration))- : targetTime;- if (Math.abs(webcamVideo.currentTime - clampedTargetTime) > (isPlaying ? 0.1 : 0.01)) {+ const targetTime = clampMediaTimeToDuration(- currentTime,++ Math.max(0, currentTime - (webcam.timeOffsetMs ?? 0) / 1000),+ Number.isFinite(webcamVideo.duration) ? webcamVideo.duration : null,+ );++ const activeSpeedRegion = speedRegionsRef.current.find(+ (region) => targetTime * 1000 >= region.startMs && targetTime * 1000 < region.endMs,+ );+ const targetPlaybackRate = activeSpeedRegion ? activeSpeedRegion.speed : 1;+ if (Math.abs(webcamVideo.playbackRate - targetPlaybackRate) > 0.001) {+ webcamVideo.playbackRate = targetPlaybackRate;+ }++ const previousTimelineTime = lastWebcamSyncTimeRef.current;+ const timelineJumped =+ previousTimelineTime === null || Math.abs(targetTime - previousTimelineTime) > 0.25;+ const driftThreshold = isPlaying ? 0.35 : 0.01;+ if (timelineJumped || Math.abs(webcamVideo.currentTime - targetTime) > driftThreshold) {try {- webcamVideo.currentTime = clampedTargetTime;+ webcamVideo.currentTime = targetTime;} catch {// no-op}diff --cc src/components/video-editor/projectPersistence.tsindex 7720b975,19271db7..b8a1c500--- a/src/components/video-editor/projectPersistence.ts+++ b/src/components/video-editor/projectPersistence.ts@@@ -585,31 -404,10 +586,34 @@@ export function normalizeProjectEditor(enabled:typeof webcam.enabled === "boolean" ? webcam.enabled : DEFAULT_WEBCAM_OVERLAY.enabled,sourcePath: webcamSourcePath,+ timeOffsetMs: isFiniteNumber(webcam.timeOffsetMs)+ ? Math.round(clamp(webcam.timeOffsetMs, -30_000, 30_000))+ : DEFAULT_WEBCAM_TIME_OFFSET_MS,mirror: typeof webcam.mirror === "boolean" ? webcam.mirror : DEFAULT_WEBCAM_OVERLAY.mirror,+ positionPreset:+ webcam.positionPreset === "top-left" ||+ webcam.positionPreset === "top-center" ||+ webcam.positionPreset === "top-right" ||+ webcam.positionPreset === "center-left" ||+ webcam.positionPreset === "center" ||+ webcam.positionPreset === "center-right" ||+ webcam.positionPreset === "bottom-left" ||+ webcam.positionPreset === "bottom-center" ||+ webcam.positionPreset === "bottom-right" ||+ webcam.positionPreset === "custom"+ ? webcam.positionPreset+ : webcam.corner === "top-left" ||+ webcam.corner === "top-right" ||+ webcam.corner === "bottom-left" ||+ webcam.corner === "bottom-right"+ ? webcam.corner+ : DEFAULT_WEBCAM_POSITION_PRESET,+ positionX: isFiniteNumber(webcam.positionX)+ ? clamp(webcam.positionX, 0, 1)+ : DEFAULT_WEBCAM_POSITION_X,+ positionY: isFiniteNumber(webcam.positionY)+ ? clamp(webcam.positionY, 0, 1)+ : DEFAULT_WEBCAM_POSITION_Y,corner:webcam.corner === "top-left" ||webcam.corner === "top-right" ||diff --cc src/components/video-editor/types.tsindex 4eedb513,a1341c52..2c5eaf76--- a/src/components/video-editor/types.ts+++ b/src/components/video-editor/types.ts@@@ -69,11 -49,9 +69,12 @@@ export type WebcamPositionPresetexport interface WebcamOverlaySettings {enabled: boolean;sourcePath: string | null;+ timeOffsetMs: number;mirror: boolean;corner: WebcamCorner;+ positionPreset: WebcamPositionPreset;+ positionX: number;+ positionY: number;size: number;reactToZoom: boolean;cornerRadius: number;@@@ -83,36 -61,23 +84,38 @@@export const DEFAULT_CURSOR_SIZE = 3.0;export const DEFAULT_CURSOR_SMOOTHING = 0.67;-export const DEFAULT_CURSOR_MOTION_BLUR = 0.35;+export const DEFAULT_CURSOR_MOTION_BLUR = 0.4;export const DEFAULT_CURSOR_CLICK_BOUNCE = 2.5;+export const DEFAULT_CURSOR_CLICK_BOUNCE_DURATION = 350;export const DEFAULT_CURSOR_SWAY = 0.25;export const DEFAULT_ZOOM_MOTION_BLUR = 0.35;-export const DEFAULT_WEBCAM_SIZE = 35;+export const DEFAULT_ZOOM_IN_DURATION_MS = 1522.575;+export const DEFAULT_ZOOM_IN_OVERLAP_MS = 500;+export const DEFAULT_ZOOM_OUT_DURATION_MS = 1015.05;+export const DEFAULT_CONNECTED_ZOOM_GAP_MS = 1500;+export const DEFAULT_CONNECTED_ZOOM_DURATION_MS = 1000;+export const DEFAULT_ZOOM_IN_EASING: ZoomTransitionEasing = "recordly";+export const DEFAULT_ZOOM_OUT_EASING: ZoomTransitionEasing = "recordly";+export const DEFAULT_CONNECTED_ZOOM_EASING: ZoomTransitionEasing = "glide";+export const DEFAULT_WEBCAM_SIZE = 40;export const DEFAULT_WEBCAM_REACT_TO_ZOOM = true;-export const DEFAULT_WEBCAM_CORNER_RADIUS = 18;-export const DEFAULT_WEBCAM_SHADOW = 0.35;+export const DEFAULT_WEBCAM_CORNER_RADIUS = 90;+export const DEFAULT_WEBCAM_SHADOW = 0.67;export const DEFAULT_WEBCAM_MARGIN = 24;+export const DEFAULT_WEBCAM_POSITION_PRESET: WebcamPositionPreset = "bottom-right";+export const DEFAULT_WEBCAM_POSITION_X = 1;+export const DEFAULT_WEBCAM_POSITION_Y = 1;+ export const DEFAULT_WEBCAM_TIME_OFFSET_MS = 0;export const DEFAULT_WEBCAM_OVERLAY: WebcamOverlaySettings = {enabled: false,sourcePath: null,+ timeOffsetMs: DEFAULT_WEBCAM_TIME_OFFSET_MS,mirror: true,corner: "bottom-right",+ positionPreset: DEFAULT_WEBCAM_POSITION_PRESET,+ positionX: DEFAULT_WEBCAM_POSITION_X,+ positionY: DEFAULT_WEBCAM_POSITION_Y,size: DEFAULT_WEBCAM_SIZE,reactToZoom: DEFAULT_WEBCAM_REACT_TO_ZOOM,cornerRadius: DEFAULT_WEBCAM_CORNER_RADIUS,diff --cc src/hooks/useScreenRecorder.tsindex 0120a732,8953f3d9..a47c41ab--- a/src/hooks/useScreenRecorder.ts+++ b/src/hooks/useScreenRecorder.ts@@@ -79,12 -78,14 +79,14 @@@ export function useScreenRecorder(): Usconst chunks = useRef<Blob[]>([]);const webcamChunks = useRef<Blob[]>([]);const startTime = useRef<number>(0);+ const webcamStartTime = useRef<number | null>(null);+ const webcamTimeOffsetMs = useRef(0);const recordingSessionTimestamp = useRef<number | null>(null);const nativeScreenRecording = useRef(false);- const wgcRecording = useRef(false);+ const nativeWindowsRecording = useRef(false);const startInFlight = useRef(false);const hasPromptedForReselect = useRef(false);- const hasShownWgcFallbackToast = useRef(false);+ const hasShownNativeWindowsFallbackToast = useRef(false);const countdownDelayLoaded = useRef(false);const pendingWebcamPathPromise = useRef<Promise<string | null> | null>(null);const webcamStopPromise = useRef<Promise<string | null> | null>(null);@@@ -345,7 -275,7 +350,7 @@@return;}- const duration = getRecordingDurationMs(Date.now());- const duration = Math.max(0, Date.now() - (webcamStartTime.current ?? Date.now()));++ const duration = Math.max(0, getRecordingDurationMs(Date.now()) - webcamTimeOffsetMs.current);const webcamBlob = new Blob(webcamChunks.current, { type: mimeType });webcamChunks.current = [];const fixedBlob = await fixWebmDuration(webcamBlob, duration);@@@ -523,7 -449,9 +532,9 @@@}recordingSessionTimestamp.current = Date.now();- startTime.current = recordingSessionTimestamp.current;+ resetRecordingClock(recordingSessionTimestamp.current);+ webcamStartTime.current = null;+ webcamTimeOffsetMs.current = 0;await startWebcamRecorder();const platform = await window.electronAPI.getPlatform();@@@ -596,9 -524,13 +607,13 @@@}if (nativeResult.success) {+ const mainStartedAt = Date.now();nativeScreenRecording.current = true;- wgcRecording.current = useWgcCapture;- startTime.current = mainStartedAt;+ nativeWindowsRecording.current = useNativeWindowsCapture;- resetRecordingClock(Date.now());+ webcamTimeOffsetMs.current = webcamStartTime.current === null+ ? 0+ : webcamStartTime.current - mainStartedAt;++ resetRecordingClock(mainStartedAt);setRecording(true);window.electronAPI?.setRecordingState(true);@@@ -824,8 -747,12 +839,12 @@@recorder.onerror = () => {setRecording(false);};+ const mainStartedAt = Date.now();- startTime.current = mainStartedAt;++ resetRecordingClock(mainStartedAt);+ webcamTimeOffsetMs.current = webcamStartTime.current === null+ ? 0+ : webcamStartTime.current - mainStartedAt;recorder.start(RECORDER_TIMESLICE_MS);- resetRecordingClock(Date.now());setRecording(true);window.electronAPI?.setRecordingState(true);} catch (error) {