capture, encode, export wiring

This commit is contained in:
2026-05-11 23:54:21 +03:00
parent c64ec2045e
commit 2c041be5a9
5 changed files with 938 additions and 68 deletions
+22
View File
@@ -49,6 +49,25 @@ export type DownloadProgress = {
total: number | null
}
export type RecordedClip = {
temp_path: string
duration_secs: number
width: number
height: number
}
export type ExportRequest = {
format: Format
target_bytes: number
fps: number
keep_audio: boolean
}
export type ExportResult = {
output_path: string
size_bytes: number
}
export const api = {
getStatus: () => invoke<AppStatus>("get_status"),
getConfig: () => invoke<Config>("get_config"),
@@ -56,6 +75,9 @@ export const api = {
downloadFfmpeg: () => invoke<void>("download_ffmpeg"),
onFfmpegProgress: (handler: (p: DownloadProgress) => void): Promise<UnlistenFn> =>
listen<DownloadProgress>("ffmpeg-progress", (e) => handler(e.payload)),
startCapture: () => invoke<void>("start_capture"),
stopCapture: () => invoke<RecordedClip>("stop_capture"),
export: (request: ExportRequest) => invoke<ExportResult>("export", { request }),
}
export function formatBytes(n: number): string {