MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / toggleSimulatorRecording

Function toggleSimulatorRecording

packages/client/src/app/AppShell.tsx:2092–2160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2090 }
2091
2092 async function toggleSimulatorRecording() {
2093 if (!selectedSimulator) {
2094 return;
2095 }
2096 setLocalError("");
2097 if (screenRecording) {
2098 if (screenRecording.phase === "stopping") {
2099 return;
2100 }
2101 const recording = screenRecording;
2102 setScreenRecording({ ...recording, phase: "stopping" });
2103 try {
2104 const blob = await stopSimulatorScreenRecording(
2105 recording.udid,
2106 recording.recordingId,
2107 );
2108 downloadBlob(
2109 blob,
2110 `${captureFileBaseName(
2111 {
2112 ...selectedSimulator,
2113 name: recording.simulatorName,
2114 udid: recording.udid,
2115 },
2116 "Recording",
2117 )}.mp4`,
2118 );
2119 setScreenRecording(null);
2120 const successLabel = "Recording downloaded";
2121 setTransientCaptureStatus(successLabel, false);
2122 clearCaptureStatusLater(successLabel);
2123 } catch (captureError) {
2124 setScreenRecording(recording);
2125 setLocalError(
2126 captureError instanceof Error
2127 ? captureError.message
2128 : "Recording failed.",
2129 );
2130 }
2131 return;
2132 }
2133
2134 if (!selectedSimulator.isBooted) {
2135 setLocalError("Boot the simulator before recording.");
2136 return;
2137 }
2138 setTransientCaptureStatus("Starting recording...", true);
2139 try {
2140 const response = await startSimulatorScreenRecording(
2141 selectedSimulator.udid,
2142 );
2143 setCaptureStatus(null);
2144 setRecordingNow(Date.now());
2145 setScreenRecording({
2146 phase: "recording",
2147 recordingId: response.recordingId,
2148 simulatorName: selectedSimulator.name,
2149 startedAt: Date.now(),

Callers 1

AppShellFunction · 0.85

Calls 6

downloadBlobFunction · 0.85
captureFileBaseNameFunction · 0.85
clearCaptureStatusLaterFunction · 0.85

Tested by

no test coverage detected