MCPcopy
hub / github.com/callstack/agent-device / exportProcessedVideo

Function exportProcessedVideo

src/recording/overlay.ts:66–108  ·  view source on GitHub ↗
(params: {
  videoPath: string;
  scriptPath: string;
  scriptArgs: string[];
  commandDescription: string;
})

Source from the content-addressed store, hash-verified

64}
65
66async function exportProcessedVideo(params: {
67 videoPath: string;
68 scriptPath: string;
69 scriptArgs: string[];
70 commandDescription: string;
71}): Promise<void> {
72 const { videoPath, scriptPath, scriptArgs, commandDescription } = params;
73 await waitForStableFile(videoPath);
74 await waitForPlayableVideo(videoPath);
75
76 const outputPath = temporarySiblingVideoPath(videoPath);
77 try {
78 const executablePath = await compileSwiftSourceFile({ sourcePath: scriptPath });
79 await runCmd(executablePath, ['--input', videoPath, '--output', outputPath, ...scriptArgs], {
80 timeoutMs: 120_000,
81 env: buildSwiftToolEnv(),
82 });
83 await waitForPlayableVideo(outputPath);
84 fs.renameSync(outputPath, videoPath);
85 } catch (error) {
86 const cause =
87 error instanceof AppError
88 ? error
89 : new AppError(
90 'COMMAND_FAILED',
91 String(error),
92 undefined,
93 error instanceof Error ? error : undefined,
94 );
95 throw new AppError(
96 'COMMAND_FAILED',
97 commandDescription,
98 {
99 ...cause.details,
100 videoPath,
101 script: scriptPath,
102 },
103 cause,
104 );
105 } finally {
106 fs.rmSync(outputPath, { force: true });
107 }
108}
109
110function temporarySiblingVideoPath(videoPath: string): string {
111 const parsed = path.parse(videoPath);

Callers 3

trimRecordingStartFunction · 0.85
overlayRecordingTouchesFunction · 0.85
resizeRecordingFunction · 0.85

Calls 6

waitForStableFileFunction · 0.90
waitForPlayableVideoFunction · 0.90
compileSwiftSourceFileFunction · 0.90
runCmdFunction · 0.90
buildSwiftToolEnvFunction · 0.90

Tested by

no test coverage detected