Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(export): remove the hardcoded fixture path from the shipped addon
Etienne Lescot6e34584d9c2c
diff --git a/electron/ipc/nativeBridge.ts b/electron/ipc/nativeBridge.tsindex d278836b5..88b90092b 100644--- a/electron/ipc/nativeBridge.ts+++ b/electron/ipc/nativeBridge.ts@@ -400,25 +400,6 @@ export function registerNativeBridgeHandlers(context: NativeBridgeContext) {case "destroyView":compositorViewService.destroyView(request.payload.id);return createSuccessResponse(requestId, { ok: true });- case "export": {- const sender = event.sender;- const stats = await compositorViewService.export(- request.payload.outPath,- (frames) => {- if (!sender.isDestroyed()) {- sender.send("export:native-progress", frames);- }- },- );- if (!stats) {- return createErrorResponse(- requestId,- "UNAVAILABLE",- "Native compositor addon not present.",- );- }- return createSuccessResponse(requestId, stats);- }case "exportMulti": {const sender = event.sender;const stats = await compositorViewService.exportMulti(diff --git a/electron/native-bridge/services/compositorViewService.ts b/electron/native-bridge/services/compositorViewService.tsindex bbea4a529..396207506 100644--- a/electron/native-bridge/services/compositorViewService.ts+++ b/electron/native-bridge/services/compositorViewService.ts@@ -400,22 +400,6 @@ export class CompositorViewService {addon.destroyView(id);}- /** Native export (fixture -> MP4, C8). Auto-pauses live previews to free the GPU.- * `onProgress` (frames encoded so far) is optional, forwarded straight from the addon's- * own throttled (~10/s) callback — cheap, the encode loop already ticks this per frame.- * Returns null when the addon is absent. */- async export(- outPath?: string,- onProgress?: (frames: number) => void,- ): Promise<ExportStats | null> {- const addon = this.ensureAddon();- if (!addon) {- return null;- }- const target = outPath ?? path.join(app.getPath("temp"), "openscreen-native-export.mp4");- return addon.export(target, onProgress);- }-/** Native multiclip export (real timeline -> MP4). Auto-pauses previews via the addon.* `sceneJson` — same scene as the live preview (background/layout/webcam/cursor/effects);* goes through the same asset-path resolution as `setScene` (wallpaper image, cursor themediff --git a/poc-d3d/compositor-view-napi/src/lib.rs b/poc-d3d/compositor-view-napi/src/lib.rsindex 5704bbb19..41e0978a3 100644--- a/poc-d3d/compositor-view-napi/src/lib.rs+++ b/poc-d3d/compositor-view-napi/src/lib.rs@@ -10,7 +10,6 @@ use napi::threadsafe_function::{ErrorStrategy, ThreadsafeFunction, ThreadsafeFunuse napi::{Env, JsFunction, Task};use napi_derive::napi;use poc_d3d::compositor::{live_params_from_scene, Compositor};-use poc_d3d::cursor::CursorTrack;use poc_d3d::d3d::Gpu;use poc_d3d::live::{LiveView, PausedPreviews};use poc_d3d::scene::Scene;@@ -38,14 +37,6 @@ fn registry() -> &'static Mutex<HashMap<i32, LiveView>> {REGISTRY.get_or_init(|| Mutex::new(HashMap::new()))}-/// Répertoire fixture (POC) : env `OPENSCREEN_COMPOSITOR_FIXTURE`, sinon défaut local.-/// Le Lot 3 fournira les vraies sources ; ici on prouve l'embed avec la fixture.-fn fixture_dir() -> String {- std::env::var("OPENSCREEN_COMPOSITOR_FIXTURE").unwrap_or_else(|_| {- r"C:\Users\camil\Documents\repos\openscreen\.claude\worktrees\prerelease-version-tag-ee96ae\poc-d3d\fixture".to_string()- })-}-/// Crée une vue **offscreen** (pas de HWND, pas de fenêtre native). Démarre juste/// un thread de rendu qui compose chaque frame, blit-resize vers `rect.width`×/// `rect.height` (réutilise le même `ensure_resize_target`/`blit_resized` que@@ -53,10 +44,9 @@ fn fixture_dir() -> String {/// `Map`/`Unmap` et stocke un `Vec<u8>` RGBA8 tightly-packed dans la vue pour/// que `read_frame` le retourne à la glue TS.///-/// Si `screen_path`/`webcam_path` sont fournis (F3 : le vrai enregistrement de-/// l'app — deux fichiers H264 séparés), on rend ces sources ; sinon on retombe-/// sur la fixture POC. `cursor_path` optionnel (télémétrie curseur ; absent →-/// pas de curseur).+/// `screen_path` est requis (F3 : le vrai enregistrement de l'app — deux+/// fichiers H264 séparés). `webcam_path`/`cursor_path` sont optionnels+/// (absents → pas de caméra / pas de curseur).////// `rect` ne sert plus que pour `width`/`height` (résolution cible du preview) ;/// `x`/`y` sont ignorés (compat structurelle — la position est gérée par CSS).@@ -67,10 +57,10 @@ pub fn create_view(webcam_path: Option<String>,cursor_path: Option<String>,) -> Result<i32> {- let dir = fixture_dir();- let screen = screen_path.unwrap_or_else(|| format!("{dir}/screen.mp4"));- let webcam = webcam_path.unwrap_or_else(|| format!("{dir}/webcam.mp4"));- let cursor = cursor_path.unwrap_or_else(|| format!("{dir}/screen.cursor.json"));+ let screen = screen_path+ .ok_or_else(|| Error::from_reason("create_view: screen_path is required"))?;+ let webcam = webcam_path.unwrap_or_default();+ let cursor = cursor_path.unwrap_or_default();let view = LiveView::create(rect.width.max(1) as u32,rect.height.max(1) as u32,@@ -237,14 +227,6 @@ pub struct ExportStats {pub video_duration_s: f64,}-/// Export mesuré, exécuté sur un thread worker libuv (l'UI n'est pas bloquée ; la mesure-/// reste enveloppante dans `run_composited`). Config = C8 (tous effets), pour comparer-/// directement au bench headless. Le device/compositeur/encodeur vivent sur ce thread.-pub struct ExportTask {- out_path: String,- on_progress: Option<ThreadsafeFunction<u32, ErrorStrategy::Fatal>>,-}-/// Builds a `progress: &mut dyn FnMut(u64)` closure (the shape both `run_composited` and/// `run_composited_multi` already call once per encoded frame, for free — measured to not/// affect the C8 benchmark's fps) that forwards to `tsfn`, throttled to ~10/s. Encoding at@@ -296,40 +278,6 @@ impl Drop for PreviewPause {}}-impl Task for ExportTask {- type Output = (u32, f64, f64, f64);- type JsValue = ExportStats;-- fn compute(&mut self) -> Result<Self::Output> {- // Previews paused for the whole render (GPU 3D engine freed) and put back exactly as- // found when this guard drops — including on the error paths below.- let _previews = PreviewPause::begin();- let dir = fixture_dir();- let gpu = Gpu::create(false).map_err(|e| Error::from_reason(format!("{e:#}")))?;- let comp = Compositor::new(&gpu).map_err(|e| Error::from_reason(format!("{e:#}")))?;- if let Ok(t) = CursorTrack::load(&format!("{dir}/screen.cursor.json"), 100_000.0, 6.0) {- comp.set_cursor(t);- }- let cfg = config::all().pop().expect("au moins une config"); // C8- let mut progress = throttled_progress(self.on_progress.take());- let s = pipeline::run_composited(- &format!("{dir}/screen.mp4"),- &format!("{dir}/webcam.mp4"),- &self.out_path,- &gpu,- &comp,- &cfg,- &mut progress,- )- .map_err(|e| Error::from_reason(format!("{e:#}")))?;- Ok((s.frames as u32, s.wall_s, s.fps, s.video_duration_s))- }-- fn resolve(&mut self, _env: Env, out: Self::Output) -> Result<Self::JsValue> {- Ok(ExportStats { frames: out.0, wall_s: out.1, fps: out.2, video_duration_s: out.3 })- }-}-/// Convertit une fonction JS optionnelle en `ThreadsafeFunction` appelable depuis le thread/// libuv qui exécute `Task::compute` — c'est la seule façon de rappeler JS depuis là. Chaque/// appel transporte juste le nombre de frames encodées (`u32`) ; le JS connaît déjà le total@@ -341,13 +289,6 @@ fn make_progress_tsfn(.transpose()}-/// Lance un export natif (fixture → MP4, C8) et résout `Promise<ExportStats>`.-/// `on_progress(framesEncodées)` optionnel — rappelé côté JS à ~10 Hz max pendant le rendu.-#[napi]-pub fn export(out_path: String, on_progress: Option<JsFunction>) -> Result<AsyncTask<ExportTask>> {- Ok(AsyncTask::new(ExportTask { out_path, on_progress: make_progress_tsfn(on_progress)? }))-}-/// Un clip de la timeline pour l'export multiclip (JS : camelCase).#[napi(object)]pub struct ClipInput {@@ -393,7 +334,8 @@ impl Task for ExportMultiTask {type JsValue = ExportStats;fn compute(&mut self) -> Result<Self::Output> {- // See `ExportTask::compute` — same pause-and-restore contract, same guard.+ // Previews paused for the whole render (GPU 3D engine freed) and restored+ // exactly as found when this guard drops, including on the error paths.let _previews = PreviewPause::begin();let gpu = Gpu::create(false).map_err(|e| Error::from_reason(format!("{e:#}")))?;let mut cfg = config::all().pop().expect("au moins une config"); // C8diff --git a/src/components/ai-edition/ExportDialog.tsx b/src/components/ai-edition/ExportDialog.tsxindex a0256c139..eab949305 100644--- a/src/components/ai-edition/ExportDialog.tsx+++ b/src/components/ai-edition/ExportDialog.tsx@@ -36,7 +36,7 @@ import {type GifSizePreset,} from "@/lib/exporter";import { calculateMp4ExportSettings } from "@/lib/exporter/mp4ExportSettings";-import { exportMultiNative, exportNative } from "@/native";+import { exportMultiNative } from "@/native";import { nativeBridgeClient } from "@/native/client";import type { CompositorClipInput } from "@/native/contracts";import { buildSceneDescription, resolveVisibleClips } from "@/native/sceneDescription";@@ -284,15 +284,15 @@ export function ExportDialog({ open, onClose, document }: ExportDialogProps) {try {const sceneJson = JSON.stringify(buildSceneDescription(document));const outDims = tierOutputDims(quality);- const stats =- clips.length > 0- ? await exportMultiNative(clips, pickedPath, sceneJson, {- width: outDims?.width,- height: outDims?.height,- fps,- codec,- })- : await exportNative(pickedPath);+ if (clips.length === 0) {+ throw new Error(t("exportDialog.nothingToExport"));+ }+ const stats = await exportMultiNative(clips, pickedPath, sceneJson, {+ width: outDims?.width,+ height: outDims?.height,+ fps,+ codec,+ });setSavedPath(pickedPath);setPhase("done");toast.success(t("exportDialog.exportedVideo"), {diff --git a/src/i18n/locales/ar/editor.json b/src/i18n/locales/ar/editor.jsonindex f5e1a7ddc..a9f931f15 100644--- a/src/i18n/locales/ar/editor.json+++ b/src/i18n/locales/ar/editor.json@@ -205,7 +205,8 @@"exportFailed": "فشل التصدير","failedToWriteFile": "فشلت كتابة الملف","qualityUpscaleWarning": "تكبير الدقة",- "exportedVideoOf": "من الفيديو تم تصديره في"+ "exportedVideoOf": "من الفيديو تم تصديره في",+ "nothingToExport": "لا يوجد شيء للتصدير — المخطط الزمني فارغ."},"inspector": {"resetFocusPoint": "إعادة تعيين نقطة التركيز",diff --git a/src/i18n/locales/en/editor.json b/src/i18n/locales/en/editor.jsonindex aa3fd48fb..4e1c39a3b 100644--- a/src/i18n/locales/en/editor.json+++ b/src/i18n/locales/en/editor.json@@ -205,7 +205,8 @@"showInFolder": "Show in folder","exportFailed": "Export failed","failedToWriteFile": "Failed to write file",- "qualityUpscaleWarning": "Upscale"+ "qualityUpscaleWarning": "Upscale",+ "nothingToExport": "Nothing to export — the timeline is empty."},"inspector": {"resetFocusPoint": "Reset focus point",diff --git a/src/i18n/locales/es/editor.json b/src/i18n/locales/es/editor.jsonindex 3fc863588..da5379322 100644--- a/src/i18n/locales/es/editor.json+++ b/src/i18n/locales/es/editor.json@@ -205,7 +205,8 @@"exportFailed": "Error al exportar","failedToWriteFile": "No se pudo escribir el archivo","qualityUpscaleWarning": "Upscaling",- "exportedVideoOf": "de vídeo exportado en"+ "exportedVideoOf": "de vídeo exportado en",+ "nothingToExport": "Nada que exportar: la línea de tiempo está vacía."},"inspector": {"resetFocusPoint": "Restablecer punto de enfoque",diff --git a/src/i18n/locales/fr/editor.json b/src/i18n/locales/fr/editor.jsonindex 3f84a8550..1d3ea011f 100644--- a/src/i18n/locales/fr/editor.json+++ b/src/i18n/locales/fr/editor.json@@ -205,7 +205,8 @@"showInFolder": "Afficher dans le dossier","exportFailed": "Échec de l'export","failedToWriteFile": "Échec de l'écriture du fichier",- "qualityUpscaleWarning": "Upscaling"+ "qualityUpscaleWarning": "Upscaling",+ "nothingToExport": "Rien à exporter — la timeline est vide."},"inspector": {"resetFocusPoint": "Réinitialiser le point de focus",diff --git a/src/i18n/locales/it/editor.json b/src/i18n/locales/it/editor.jsonindex fa1365d28..079a0ef27 100644--- a/src/i18n/locales/it/editor.json+++ b/src/i18n/locales/it/editor.json@@ -205,7 +205,8 @@"exportFailed": "Esportazione non riuscita","failedToWriteFile": "Impossibile scrivere il file","qualityUpscaleWarning": "Upscaling",- "exportedVideoOf": "di video esportato in"+ "exportedVideoOf": "di video esportato in",+ "nothingToExport": "Niente da esportare: la timeline è vuota."},"inspector": {"resetFocusPoint": "Reimposta punto di messa a fuoco",diff --git a/src/i18n/locales/ja-JP/editor.json b/src/i18n/locales/ja-JP/editor.jsonindex de6283dc1..445e7f163 100644--- a/src/i18n/locales/ja-JP/editor.json+++ b/src/i18n/locales/ja-JP/editor.json@@ -205,7 +205,8 @@"exportFailed": "エクスポートに失敗しました","failedToWriteFile": "ファイルの書き込みに失敗しました","qualityUpscaleWarning": "アップスケール",- "exportedVideoOf": "の動画を書き出しました。所要時間:"+ "exportedVideoOf": "の動画を書き出しました。所要時間:",+ "nothingToExport": "書き出す内容がありません — タイムラインが空です。"},"inspector": {"resetFocusPoint": "フォーカスポイントをリセット",diff --git a/src/i18n/locales/ko-KR/editor.json b/src/i18n/locales/ko-KR/editor.jsonindex ed83e85e9..60012d55f 100644--- a/src/i18n/locales/ko-KR/editor.json+++ b/src/i18n/locales/ko-KR/editor.json@@ -205,7 +205,8 @@"exportFailed": "내보내기 실패","failedToWriteFile": "파일 쓰기에 실패했습니다","qualityUpscaleWarning": "업스케일",- "exportedVideoOf": "분량의 영상을 내보냈습니다. 소요 시간:"+ "exportedVideoOf": "분량의 영상을 내보냈습니다. 소요 시간:",+ "nothingToExport": "내보낼 항목이 없습니다 — 타임라인이 비어 있습니다."},"inspector": {"resetFocusPoint": "포커스 지점 재설정",diff --git a/src/i18n/locales/pt-BR/editor.json b/src/i18n/locales/pt-BR/editor.jsonindex 165426e4e..82534fac8 100644--- a/src/i18n/locales/pt-BR/editor.json+++ b/src/i18n/locales/pt-BR/editor.json@@ -205,7 +205,8 @@"exportFailed": "Falha na exportação","failedToWriteFile": "Falha ao gravar o arquivo","qualityUpscaleWarning": "Upscaling",- "exportedVideoOf": "de vídeo exportado em"+ "exportedVideoOf": "de vídeo exportado em",+ "nothingToExport": "Nada para exportar — a linha do tempo está vazia."},"inspector": {"resetFocusPoint": "Redefinir ponto de foco",diff --git a/src/i18n/locales/ru/editor.json b/src/i18n/locales/ru/editor.jsonindex 06592ef81..6e3c4199e 100644--- a/src/i18n/locales/ru/editor.json+++ b/src/i18n/locales/ru/editor.json@@ -205,7 +205,8 @@"exportFailed": "Ошибка экспорта","failedToWriteFile": "Не удалось записать файл","qualityUpscaleWarning": "Апскейл",- "exportedVideoOf": "видео экспортировано за"+ "exportedVideoOf": "видео экспортировано за",+ "nothingToExport": "Нечего экспортировать — таймлайн пуст."},"inspector": {"resetFocusPoint": "Сбросить точку фокуса",diff --git a/src/i18n/locales/tr/editor.json b/src/i18n/locales/tr/editor.jsonindex d0b927586..ba94a2f00 100644--- a/src/i18n/locales/tr/editor.json+++ b/src/i18n/locales/tr/editor.json@@ -205,7 +205,8 @@"exportFailed": "Dışa aktarma başarısız oldu","failedToWriteFile": "Dosya yazılamadı","qualityUpscaleWarning": "Upscale",- "exportedVideoOf": "video şu sürede dışa aktarıldı:"+ "exportedVideoOf": "video şu sürede dışa aktarıldı:",+ "nothingToExport": "Dışa aktarılacak bir şey yok — zaman çizelgesi boş."},"inspector": {"resetFocusPoint": "Odak noktasını sıfırla",diff --git a/src/i18n/locales/vi/editor.json b/src/i18n/locales/vi/editor.jsonindex 5b16f995b..1589b6258 100644--- a/src/i18n/locales/vi/editor.json+++ b/src/i18n/locales/vi/editor.json@@ -205,7 +205,8 @@"exportFailed": "Xuất thất bại","failedToWriteFile": "Không thể ghi tệp","qualityUpscaleWarning": "Upscale",- "exportedVideoOf": "video đã xuất trong"+ "exportedVideoOf": "video đã xuất trong",+ "nothingToExport": "Không có gì để xuất — dòng thời gian trống."},"inspector": {"resetFocusPoint": "Đặt lại điểm lấy nét",diff --git a/src/i18n/locales/zh-CN/editor.json b/src/i18n/locales/zh-CN/editor.jsonindex b9c0ebe2f..82643672a 100644--- a/src/i18n/locales/zh-CN/editor.json+++ b/src/i18n/locales/zh-CN/editor.json@@ -205,7 +205,8 @@"exportFailed": "导出失败","failedToWriteFile": "写入文件失败","qualityUpscaleWarning": "放大",- "exportedVideoOf": "的视频已导出,用时"+ "exportedVideoOf": "的视频已导出,用时",+ "nothingToExport": "没有可导出的内容 — 时间轴为空。"},"inspector": {"resetFocusPoint": "重置焦点",diff --git a/src/i18n/locales/zh-TW/editor.json b/src/i18n/locales/zh-TW/editor.jsonindex 478e4ef33..d8e0487a2 100644--- a/src/i18n/locales/zh-TW/editor.json+++ b/src/i18n/locales/zh-TW/editor.json@@ -205,7 +205,8 @@"exportFailed": "匯出失敗","failedToWriteFile": "寫入檔案失敗","qualityUpscaleWarning": "放大",- "exportedVideoOf": "的影片已匯出,耗時"+ "exportedVideoOf": "的影片已匯出,耗時",+ "nothingToExport": "沒有可匯出的內容 — 時間軸為空。"},"inspector": {"resetFocusPoint": "重設焦點",diff --git a/src/native/compositorViewClient.ts b/src/native/compositorViewClient.tsindex 3380a699c..5edca550a 100644--- a/src/native/compositorViewClient.ts+++ b/src/native/compositorViewClient.ts@@ -113,14 +113,6 @@ export function destroyCompositorView(id: number): Promise<{ ok: true }> {});}-export function exportNative(outPath?: string): Promise<CompositorExportResult> {- return requireNativeBridgeData<CompositorExportResult>({- domain: "compositor",- action: "export",- payload: { outPath },- });-}-export function exportMultiNative(clips: CompositorClipInput[],outPath?: string,diff --git a/src/native/contracts.ts b/src/native/contracts.tsindex b8518b6eb..b2b66f8eb 100644--- a/src/native/contracts.ts+++ b/src/native/contracts.ts@@ -735,12 +735,6 @@ export type NativeBridgeRequest =payload: { id: number };requestId?: string;}- | {- domain: "compositor";- action: "export";- payload: { outPath?: string };- requestId?: string;- }| {domain: "compositor";action: "exportMulti";