MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / startSimulatorVideoCapture

Function startSimulatorVideoCapture

src/utils/video_capture.ts:158–240  ·  view source on GitHub ↗
(
  params: { simulatorUuid: string; fps?: number },
  executor: CommandExecutor,
  axeHelpers?: AxeHelpers,
)

Source from the content-addressed store, hash-verified

156}
157
158export async function startSimulatorVideoCapture(
159 params: { simulatorUuid: string; fps?: number },
160 executor: CommandExecutor,
161 axeHelpers?: AxeHelpers,
162): Promise<StartVideoCaptureResult> {
163 const simulatorUuid = params.simulatorUuid;
164 if (!simulatorUuid) {
165 return { started: false, error: 'simulatorUuid is required' };
166 }
167
168 if (sessions.has(simulatorUuid)) {
169 return {
170 started: false,
171 error: 'A video recording session is already active for this simulator. Stop it first.',
172 };
173 }
174
175 const helpers = axeHelpers ?? {
176 getAxePath,
177 getBundledAxeEnvironment,
178 };
179
180 const axeBinary = helpers.getAxePath();
181 if (!axeBinary) {
182 return { started: false, error: 'Bundled AXe binary not found' };
183 }
184
185 const fps = Number.isFinite(params.fps as number) ? Number(params.fps) : 30;
186 const command = [axeBinary, 'record-video', '--udid', simulatorUuid, '--fps', String(fps)];
187 const env = helpers.getBundledAxeEnvironment?.() ?? {};
188
189 log('info', `Starting AXe video recording for simulator ${simulatorUuid} at ${fps} fps`);
190
191 const result = await executor(command, 'Start Simulator Video Capture', false, { env }, true);
192
193 if (!result.success || !result.process) {
194 return {
195 started: false,
196 error: result.error ?? 'Failed to start video capture process',
197 };
198 }
199
200 const child = result.process as ChildProcess;
201 const session: Session = {
202 process: child,
203 sessionId: createSessionId(simulatorUuid),
204 startedAt: Date.now(),
205 buffer: '',
206 ended: false,
207 releaseActivity: acquireDaemonActivity('video.capture'),
208 };
209
210 try {
211 child.stdout?.on('data', (d: unknown) => {
212 session.buffer += String(d ?? '');
213 });
214 child.stderr?.on('data', (d: unknown) => {
215 session.buffer += String(d ?? '');

Callers

nothing calls this directly

Calls 6

logFunction · 0.90
acquireDaemonActivityFunction · 0.90
createSessionIdFunction · 0.85
onceMethod · 0.65
executorFunction · 0.50

Tested by

no test coverage detected