Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: changing playback time while video is playing (#968)
Ameer Al Ashhabc160af56b004
diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsxindex e7bd9149d..646c7655a 100644--- a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx@@ -368,9 +368,9 @@ function Page() {</div></WindowChromeHeader><Show when={signIn.isPending}>- <div class="bg-gray-1 absolute inset-0 flex items-center justify-center animate-in fade-in">- <div class="flex flex-col items-center justify-center gap-4">- <span>Singning In...</span>+ <div class="flex absolute inset-0 justify-center items-center bg-gray-1 animate-in fade-in">+ <div class="flex flex-col gap-4 justify-center items-center">+ <span>Signing In...</span><ButtononClick={() => {diff --git a/apps/desktop/src/routes/editor/Timeline/index.tsx b/apps/desktop/src/routes/editor/Timeline/index.tsxindex 133b24a11..65735d406 100644--- a/apps/desktop/src/routes/editor/Timeline/index.tsx+++ b/apps/desktop/src/routes/editor/Timeline/index.tsx@@ -7,7 +7,8 @@ import { produce } from "solid-js/store";import "./styles.css";-import { useEditorContext } from "../context";+import { commands } from "~/utils/tauri";+import { FPS, OUTPUT_SIZE, useEditorContext } from "../context";import { formatTime } from "../utils";import { ClipTrack } from "./ClipTrack";import { TimelineContextProvider, useTimelineContext } from "./context";@@ -82,13 +83,35 @@ export function Timeline() {zoomSegmentDragState.type !== "moving" &&sceneSegmentDragState.type !== "moving") {- setEditorState(- "playbackTime",- Math.min(- secsPerPixel() * (e.clientX - left!) + transform().position,- totalDuration(),- ),- );+ // Guard against missing bounds and clamp computed time to [0, totalDuration()]+ if (left == null) return;+ const rawTime =+ secsPerPixel() * (e.clientX - left) + transform().position;+ const newTime = Math.min(Math.max(0, rawTime), totalDuration());++ // If playing, some backends require restart to seek reliably+ if (editorState.playing) {+ try {+ await commands.stopPlayback();++ // Round to nearest frame to prevent off-by-one drift+ const targetFrame = Math.round(newTime * FPS);+ await commands.seekTo(targetFrame);++ // If the user paused during these async ops, bail out without restarting+ if (!editorState.playing) {+ setEditorState("playbackTime", newTime);+ return;+ }++ await commands.startPlayback(FPS, OUTPUT_SIZE);+ setEditorState("playing", true);+ } catch (err) {+ console.error("Failed to seek during playback:", err);+ }+ }++ setEditorState("playbackTime", newTime);}}