@appium/coresim 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +14 -0
  3. package/binding.gyp +14 -1
  4. package/lib/src/commands/video-recording.d.ts +57 -0
  5. package/lib/src/commands/video-recording.d.ts.map +1 -0
  6. package/lib/src/commands/video-recording.js +123 -0
  7. package/lib/src/commands/video-recording.js.map +1 -0
  8. package/lib/src/commands/video-stream.d.ts +92 -0
  9. package/lib/src/commands/video-stream.d.ts.map +1 -0
  10. package/lib/src/commands/video-stream.js +242 -0
  11. package/lib/src/commands/video-stream.js.map +1 -0
  12. package/lib/src/index.d.ts +2 -1
  13. package/lib/src/index.d.ts.map +1 -1
  14. package/lib/src/index.js +1 -0
  15. package/lib/src/index.js.map +1 -1
  16. package/lib/src/native-simctl.d.ts +4 -0
  17. package/lib/src/native-simctl.d.ts.map +1 -1
  18. package/lib/src/native-simctl.js +21 -1
  19. package/lib/src/native-simctl.js.map +1 -1
  20. package/lib/src/types.d.ts +134 -0
  21. package/lib/src/types.d.ts.map +1 -1
  22. package/lib/src/utils/index.d.ts +1 -1
  23. package/lib/src/utils/index.d.ts.map +1 -1
  24. package/lib/src/utils/index.js +1 -1
  25. package/lib/src/utils/index.js.map +1 -1
  26. package/lib/src/utils/run-catching.d.ts +4 -0
  27. package/lib/src/utils/run-catching.d.ts.map +1 -1
  28. package/lib/src/utils/run-catching.js +11 -0
  29. package/lib/src/utils/run-catching.js.map +1 -1
  30. package/package.json +1 -1
  31. package/prebuilds/darwin-arm64/@appium+coresim.node +0 -0
  32. package/src/commands/video-recording.ts +158 -0
  33. package/src/commands/video-stream.ts +283 -0
  34. package/src/coresim.mm +708 -1
  35. package/src/index.ts +4 -0
  36. package/src/native/audio_encoder.h +65 -0
  37. package/src/native/audio_encoder.mm +270 -0
  38. package/src/native/av_recording.h +52 -0
  39. package/src/native/av_recording.mm +424 -0
  40. package/src/native/av_stream.h +70 -0
  41. package/src/native/av_stream.mm +217 -0
  42. package/src/native/monotonic_clock.h +20 -0
  43. package/src/native/sim_audio_tap.h +67 -0
  44. package/src/native/sim_audio_tap.mm +350 -0
  45. package/src/native/sim_process.h +10 -0
  46. package/src/native/sim_process.mm +81 -18
  47. package/src/native/sim_screenshot.h +10 -0
  48. package/src/native/sim_screenshot.mm +11 -6
  49. package/src/native/sim_video_recording.h +27 -0
  50. package/src/native/sim_video_recording.mm +87 -0
  51. package/src/native/sim_video_stream.h +64 -0
  52. package/src/native/sim_video_stream.mm +71 -0
  53. package/src/native/video_encoder.h +76 -0
  54. package/src/native/video_encoder.mm +417 -0
  55. package/src/native-simctl.ts +22 -1
  56. package/src/types.ts +149 -0
  57. package/src/utils/index.ts +1 -1
  58. package/src/utils/run-catching.ts +11 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,aAAa,CAAC;AACvH,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EACL,aAAa,EACb,cAAc,GAef,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,aAAa,CAAC;AACvH,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAGvD,OAAO,EACL,aAAa,EACb,cAAc,GAkBf,MAAM,YAAY,CAAC"}
@@ -12,6 +12,8 @@ import './commands/process.js';
12
12
  import './commands/screenshot.js';
13
13
  import './commands/spawn.js';
14
14
  import './commands/ui.js';
15
+ import './commands/video-recording.js';
16
+ import './commands/video-stream.js';
15
17
  import './commands/webinspector.js';
16
18
  import './commands/app.js';
17
19
  import './commands/biometric.js';
@@ -27,6 +29,8 @@ import './commands/process.js';
27
29
  import './commands/screenshot.js';
28
30
  import './commands/spawn.js';
29
31
  import './commands/ui.js';
32
+ import './commands/video-recording.js';
33
+ import './commands/video-stream.js';
30
34
  import './commands/webinspector.js';
31
35
  /**
32
36
  * Drives `CoreSimulator.framework` directly — no `simctl`/`xcrun` subprocess — for the operations
@@ -1 +1 @@
1
- {"version":3,"file":"native-simctl.d.ts","sourceRoot":"","sources":["../../src/native-simctl.ts"],"names":[],"mappings":"AAKA,OASO,mBAAmB,CAAC;AAC3B,OAAuE,yBAAyB,CAAC;AACjG,OAIO,mCAAmC,CAAC;AAC3C,OAA4E,2BAA2B,CAAC;AACxG,OAAgE,wBAAwB,CAAC;AACzF,OAYO,yBAAyB,CAAC;AACjC,OAA2C,qBAAqB,CAAC;AACjE,OAAoB,oBAAoB,CAAC;AACzC,OAA2C,0BAA0B,CAAC;AACtE,OAAgF,2BAA2B,CAAC;AAC5G,OAAgD,uBAAuB,CAAC;AACxE,OAAyC,0BAA0B,CAAC;AACpE,OAA2B,qBAAqB,CAAC;AACjD,OAOO,kBAAkB,CAAC;AAC1B,OAAoC,4BAA4B,CAAC;AAKjE,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC;AAChC,OAAO,yBAAyB,CAAC;AACjC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,0BAA0B,CAAC;AAClC,OAAO,2BAA2B,CAAC;AACnC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,0BA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OAAO,2BAA2B,CAAC;AACnC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,0BAA0B,CAAC;AAClC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,+BAA+B,CAAC;AACvC,OAAO,4BAA4B,CAAC;AACpC,OAAO,4BAA4B,CAAC;AAYpC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAY;IAYrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAZjC,OAAO,CAAC,oBAAoB,CAAkD;IAE9E;;;;;;;OAOG;gBAEgB,YAAY,CAAC,EAAE,MAAM,YAAA,EACrB,aAAa,CAAC,EAAE,MAAM,YAAA;IAGzC,4FAA4F;WAC/E,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;CAkDjD"}
@@ -15,6 +15,8 @@ import { getRuntimeRootPath, listProcesses } from './commands/process.js';
15
15
  import { getDisplays, getScreenshot } from './commands/screenshot.js';
16
16
  import { spawnProcess } from './commands/spawn.js';
17
17
  import { getAppearance, getContentSize, getIncreaseContrast, setAppearance, setContentSize, setIncreaseContrast, } from './commands/ui.js';
18
+ import { isVideoRecording, startVideoRecording, stopVideoRecording } from './commands/video-recording.js';
19
+ import { startVideoStream } from './commands/video-stream.js';
18
20
  import { getWebInspectorSocket } from './commands/webinspector.js';
19
21
  // Bare re-imports so `declare module './native-simctl.js'` augmentations in the command modules
20
22
  // (which add their methods to NativeSimctl's type) reach downstream consumers' emitted .d.ts
@@ -34,6 +36,8 @@ import './commands/process.js';
34
36
  import './commands/screenshot.js';
35
37
  import './commands/spawn.js';
36
38
  import './commands/ui.js';
39
+ import './commands/video-recording.js';
40
+ import './commands/video-stream.js';
37
41
  import './commands/webinspector.js';
38
42
  import { NativeSimUnavailableError } from './errors.js';
39
43
  import { getPkgRoot, PACKAGE_NAME, runCatchingAsync } from './utils/index.js';
@@ -182,6 +186,11 @@ Object.assign(NativeSimctl.prototype, {
182
186
  // screenshot
183
187
  getScreenshot,
184
188
  getDisplays,
189
+ // video recording
190
+ startVideoRecording,
191
+ stopVideoRecording,
192
+ isVideoRecording,
193
+ startVideoStream,
185
194
  // webinspector
186
195
  getWebInspectorSocket,
187
196
  // spawn
@@ -199,7 +208,18 @@ const loadNative = util.memoize(function loadNative() {
199
208
  if (process.platform !== 'darwin') {
200
209
  throw new NativeSimUnavailableError(`${PACKAGE_NAME} requires macOS — CoreSimulator.framework does not exist on ${process.platform}`, 'platform', process.platform, 'n/a');
201
210
  }
202
- return require('node-gyp-build')(getPkgRoot());
211
+ const native = require('node-gyp-build')(getPkgRoot());
212
+ // A forgotten (never explicitly stopped) AV recording/stream otherwise silently loses data —
213
+ // or just leaks a live encoder — the instant a caller force-exits via `process.exit()`, since
214
+ // Node's own cleanup hooks (coresim.mm's CleanupActiveSessions, registered against the exact
215
+ // same condition) are confirmed to NOT run in that path, only on a natural empty-event-loop
216
+ // exit or a Worker's own termination. `process.on('exit', ...)` does fire for `process.exit()`
217
+ // too, and (per Node's own contract) may run synchronous code — flushActiveSessions() qualifies:
218
+ // it's a single blocking native call, not new async JS work. Registered once, lazily, here
219
+ // rather than at module import time, so merely importing this package on a non-macOS platform
220
+ // never touches `process` for something it'll never need.
221
+ process.on('exit', () => native.flushActiveSessions());
222
+ return native;
203
223
  });
204
224
  const DEFAULT_DEVELOPER_DIR_TIMEOUT_MS = 15_000;
205
225
  function defaultDeveloperDir() {
@@ -1 +1 @@
1
- {"version":3,"file":"native-simctl.js","sourceRoot":"","sources":["../../src/native-simctl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAErC,OAAO,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,EACd,SA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6FAA6F;IAC7F,8FAA8F;IAC9F,6FAA6F;IAC7F,4FAA4F;IAC5F,+FAA+F;IAC/F,iGAAiG;IACjG,2FAA2F;IAC3F,8FAA8F;IAC9F,0DAA0D;IAC1D,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC;AAEH,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAEhD,SAAS,mBAAmB;IAC1B,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,gCAAgC;SAC1C,CAAC,CAAC,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,4FAA4F;QAC5F,sFAAsF;QACtF,iGAAiG;QACjG,IAAK,GAA6B,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,gFAAgF,EAAE;gBAChG,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;QACL,CAAC;QACD,IAAK,GAA6B,EAAE,IAAI,KAAK,WAAW,EAAE,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,0CAA0C,gCAAgC,IAAI,EAAE,EAAC,KAAK,EAAE,GAAG,EAAC,CAAC,CAAC;QAChH,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -104,6 +104,87 @@ export interface ScreenshotOptions {
104
104
  */
105
105
  quality?: number;
106
106
  }
107
+ /** Options for `NativeSimctl.startVideoRecording`. */
108
+ export interface VideoRecordingOptions {
109
+ /**
110
+ * Which display to record, by `id` from `getDisplays()`. Defaults to the primary display
111
+ * (falling back to the first renderable display if none is primary, e.g. tvOS).
112
+ */
113
+ displayId?: string;
114
+ /** Video codec — `'h264'` (default) or `'hevc'`. */
115
+ codec?: 'h264' | 'hevc';
116
+ /**
117
+ * For a non-rectangular display (e.g. a Dynamic Island cutout): `'ignored'` (default) saves the
118
+ * unmasked framebuffer, `'black'` renders the mask black, `'alpha'` is not supported and
119
+ * behaves like `'black'`. Only applies when neither `audio` nor `fps` is set — see their doc
120
+ * comments.
121
+ */
122
+ mask?: 'ignored' | 'alpha' | 'black';
123
+ /**
124
+ * Also capture the device's audio into the same file, muxed as a second track. Defaults to
125
+ * `false`. Requires macOS 14.2+ (Core Audio process taps), the host's "System Audio Recording
126
+ * Only" privacy permission (System Settings > Privacy & Security — cannot be granted
127
+ * programmatically; a denial isn't a thrown error, it surfaces as a silent, audio-less/near-
128
+ * silent recording), a default audio output device on the host, and a booted device that has
129
+ * produced audio at least once. See the README's "Screen capture" section for the full
130
+ * requirements list and known failure modes.
131
+ *
132
+ * Like an explicit `fps`, this switches the implementation to this addon's own VideoToolbox +
133
+ * Core Audio encoders instead of CoreSimulator's private recorder, which can't mux audio.
134
+ */
135
+ audio?: boolean;
136
+ /**
137
+ * Max frames/sec to poll the framebuffer at — see {@link VideoStreamOptions} `fps` for the
138
+ * identical semantics. Meaningless against CoreSimulator's private recorder (it captures on its
139
+ * own cadence, not one we poll), so setting `fps` — even without `audio` — switches this
140
+ * recording to the same own-encoder implementation `audio` does. That switch costs `mask`
141
+ * support, which only the private recorder implements.
142
+ */
143
+ fps?: number;
144
+ /** Target average bitrate, in bits/sec. Respected on either implementation. */
145
+ bitrate?: number;
146
+ }
147
+ /** Options for `NativeSimctl.startVideoStream`. */
148
+ export interface VideoStreamOptions {
149
+ /**
150
+ * Which display to stream, by `id` from `getDisplays()`. Defaults to the primary display
151
+ * (falling back to the first renderable display if none is primary, e.g. tvOS).
152
+ */
153
+ displayId?: string;
154
+ /** Video codec — `'h264'` (default) or `'hevc'`. */
155
+ codec?: 'h264' | 'hevc';
156
+ /**
157
+ * Max frames/sec to poll the framebuffer at — an unchanged frame is never re-encoded, so this
158
+ * is an upper bound, not a guarantee. Must be >= 1. Defaults to 15.
159
+ */
160
+ fps?: number;
161
+ /** Target average bitrate, in bits/sec. Defaults to 2,000,000 (2 Mbps). */
162
+ bitrate?: number;
163
+ /**
164
+ * Also stream the device's audio, interleaved into the same `accessUnits()` sequence. Defaults
165
+ * to `false`. Same requirements and failure modes as {@link VideoRecordingOptions.audio} — see
166
+ * its doc comment and the README's "Screen capture" section.
167
+ */
168
+ audio?: boolean;
169
+ }
170
+ /**
171
+ * One encoded unit from `VideoStream.accessUnits()`, discriminated by `track`: a video unit
172
+ * (Annex-B NAL units — a keyframe's `data` has parameter sets, SPS/PPS or VPS/SPS/PPS for HEVC,
173
+ * prepended, so it's self-decodable alone) or, when {@link VideoStreamOptions.audio} was set, an
174
+ * interleaved audio unit (an ADTS-framed AAC-LC packet — the 7-byte ADTS header carries sample
175
+ * rate/channel count itself, so no separate decoder-config exchange is needed; always
176
+ * independently decodable, so `isKeyFrame` is always `true`). Without `audio`, every unit has
177
+ * `track: 'video'`.
178
+ */
179
+ export interface VideoAccessUnit {
180
+ track: 'video' | 'audio';
181
+ data: Buffer;
182
+ isKeyFrame: boolean;
183
+ /** Monotonically increasing per track, starting at 0 — independent between `'video'` and `'audio'`. */
184
+ sequence: number;
185
+ /** Microseconds since the stream started, on one shared clock across both tracks. */
186
+ timestampMicros: number;
187
+ }
107
188
  /**
108
189
  * Options for `NativeSimctl.spawnProcess`, passed through to CoreSimulator's
109
190
  * `spawnWithPath:options:terminationQueue:terminationHandler:error:`. Only keys confirmed
@@ -195,6 +276,37 @@ export interface NativeSpawnResult {
195
276
  * mirroring Node's own `ChildProcess` `'exit'` event — exactly one of `code`/`signal` is set.
196
277
  */
197
278
  export type NativeSpawnExitCallback = (code: number | null, signal: number | null) => void;
279
+ /** Raw shape of an access unit as the native addon delivers it — see {@link VideoAccessUnit}. */
280
+ export interface NativeVideoAccessUnit {
281
+ track: 'video' | 'audio';
282
+ data: Buffer;
283
+ isKeyFrame: boolean;
284
+ sequence: number;
285
+ timestampMicros: number;
286
+ }
287
+ export type NativeVideoAccessUnitCallback = (unit: NativeVideoAccessUnit) => void;
288
+ export type NativeVideoErrorCallback = (err: Error) => void;
289
+ /**
290
+ * A live encoder session, wrapped by `coresim.mm`'s `NativeVideoStream` (video only) or
291
+ * `NativeAVStream` (`audio: true` — see {@link VideoStreamOptions}) — either way, what
292
+ * `NativeDeviceHandle.startVideoStream()` resolves to; the two native wrapper classes expose the
293
+ * identical shape below, so callers never need to know which one they got.
294
+ */
295
+ export interface NativeVideoStreamHandle {
296
+ stop(): Promise<void>;
297
+ /** Forces the next encoded video frame to be a keyframe — trivial in-memory flag, so synchronous. */
298
+ requestKeyFrame(): void;
299
+ }
300
+ /**
301
+ * A live recording, wrapped by `coresim.mm`'s `NativePrivateRecordingHandle` (video only,
302
+ * addressing CoreSimulator's own internally-tracked private recorder) or `NativeAVRecording`
303
+ * (`audio: true` — see {@link VideoRecordingOptions}, a real local resource with no server-side
304
+ * counterpart) — either way, what `NativeDeviceHandle.startVideoRecording()` resolves to.
305
+ */
306
+ export interface NativeVideoRecordingHandle {
307
+ /** Resolves once the output file has been finalized on disk and is safe to read. */
308
+ stop(): Promise<void>;
309
+ }
198
310
  /** A `SimDevice`, wrapped by `coresim.mm`'s `NativeDevice` — what `NativeSimctl`'s `_findDevice()` resolves to. */
199
311
  export interface NativeDeviceHandle {
200
312
  udid(): string;
@@ -245,6 +357,21 @@ export interface NativeDeviceHandle {
245
357
  quality?: number;
246
358
  }): Promise<Buffer>;
247
359
  getDisplays(): Promise<SimDisplayInfo[]>;
360
+ startVideoRecording(outputFile: string, options: {
361
+ displayId?: string;
362
+ codec?: 'h264' | 'hevc';
363
+ mask?: 'ignored' | 'alpha' | 'black';
364
+ audio?: boolean;
365
+ fps?: number;
366
+ bitrate?: number;
367
+ } | undefined, onError: NativeVideoErrorCallback): Promise<NativeVideoRecordingHandle>;
368
+ startVideoStream(options: {
369
+ displayId?: string;
370
+ codec?: 'h264' | 'hevc';
371
+ fps?: number;
372
+ bitrate?: number;
373
+ audio?: boolean;
374
+ } | undefined, onAccessUnit: NativeVideoAccessUnitCallback, onError: NativeVideoErrorCallback): Promise<NativeVideoStreamHandle>;
248
375
  spawn(path: string, options: SpawnOptions | undefined, onExit: NativeSpawnExitCallback): Promise<NativeSpawnResult>;
249
376
  }
250
377
  /** A `SimDeviceSet`, wrapped by `coresim.mm`'s `NativeDeviceSet`. */
@@ -264,5 +391,12 @@ export interface NativeServiceContextHandle {
264
391
  export interface NativeCoreSimModule {
265
392
  sharedServiceContext(developerDir: string): Promise<NativeServiceContextHandle>;
266
393
  frameworkVersion(): Promise<string>;
394
+ /**
395
+ * Synchronously (not a Promise) stops every still-live video/AV stream or AV recording, blocking
396
+ * until each has released its resources. Meant to be called from a `process.on('exit', ...)`
397
+ * listener (see native-simctl.ts) — cleanup hooks alone don't run under `process.exit()` on the
398
+ * main process/thread, only on a natural empty-event-loop exit or a Worker's own termination.
399
+ */
400
+ flushActiveSessions(): void;
267
401
  }
268
402
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,oBAAY,cAAc;IACxB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,OAAO,IAAI;IACX,MAAM,IAAI;IACV,YAAY,IAAI;CACjB;AAED,uGAAuG;AACvG,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,CAAC;IACtB,gHAAgH;IAChH,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wGAAwG;IACxG,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,+GAA+G;AAC/G,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,IAA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AAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjH,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAED,+EAA+E;AAC/E,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAChE,oBAAoB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACrD,iBAAiB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAChD;AAED,uHAAuH;AACvH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAChF,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC;;;;;OAKG;IACH,mBAAmB,IAAI,IAAI,CAAC;CAC7B"}
@@ -1,3 +1,3 @@
1
1
  export { getPkgRoot, PACKAGE_NAME } from './pkg-root.js';
2
- export { runCatchingAsync } from './run-catching.js';
2
+ export { runCatchingAsync, toTypedError } from './run-catching.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export { getPkgRoot, PACKAGE_NAME } from './pkg-root.js';
2
- export { runCatchingAsync } from './run-catching.js';
2
+ export { runCatchingAsync, toTypedError } from './run-catching.js';
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC"}
@@ -1,3 +1,7 @@
1
1
  /** Shared by NativeSimctl and every `src/commands/*.ts` mixin — maps a raw error surfaced by the addon to a typed one. */
2
2
  export declare function runCatchingAsync<T>(fn: () => Promise<T>): Promise<T>;
3
+ /** `wrapNativeError` always throws — this just gets its thrown value back as a plain return, for
4
+ * a live callback (e.g. a stream/recording's `onError`) that needs to emit or log a typed error
5
+ * rather than raise it. */
6
+ export declare function toTypedError(err: unknown): Error;
3
7
  //# sourceMappingURL=run-catching.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-catching.d.ts","sourceRoot":"","sources":["../../../src/utils/run-catching.ts"],"names":[],"mappings":"AAEA,0HAA0H;AAC1H,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM1E"}
1
+ {"version":3,"file":"run-catching.d.ts","sourceRoot":"","sources":["../../../src/utils/run-catching.ts"],"names":[],"mappings":"AAEA,0HAA0H;AAC1H,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM1E;AAED;;2BAE2B;AAC3B,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAMhD"}
@@ -8,4 +8,15 @@ export async function runCatchingAsync(fn) {
8
8
  wrapNativeError(err);
9
9
  }
10
10
  }
11
+ /** `wrapNativeError` always throws — this just gets its thrown value back as a plain return, for
12
+ * a live callback (e.g. a stream/recording's `onError`) that needs to emit or log a typed error
13
+ * rather than raise it. */
14
+ export function toTypedError(err) {
15
+ try {
16
+ wrapNativeError(err);
17
+ }
18
+ catch (wrapped) {
19
+ return wrapped;
20
+ }
21
+ }
11
22
  //# sourceMappingURL=run-catching.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-catching.js","sourceRoot":"","sources":["../../../src/utils/run-catching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAE7C,0HAA0H;AAC1H,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAI,EAAoB;IAC5D,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"run-catching.js","sourceRoot":"","sources":["../../../src/utils/run-catching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAE7C,0HAA0H;AAC1H,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAI,EAAoB;IAC5D,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;2BAE2B;AAC3B,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,IAAI,CAAC;QACH,eAAe,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAAC,OAAO,OAAO,EAAE,CAAC;QACjB,OAAO,OAAgB,CAAC;IAC1B,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appium/coresim",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Native bindings to CoreSimulator.framework for Apple platform simulator control",
5
5
  "bugs": {
6
6
  "url": "https://github.com/appium/coresim/issues"
@@ -0,0 +1,158 @@
1
+ import path from 'node:path';
2
+
3
+ import {logger} from '@appium/support';
4
+
5
+ import type {NativeSimctl} from '../native-simctl.js';
6
+ import type {NativeVideoRecordingHandle, VideoRecordingOptions} from '../types.js';
7
+ import {runCatchingAsync, toTypedError} from '../utils/index.js';
8
+
9
+ declare module '../native-simctl.js' {
10
+ interface NativeSimctl {
11
+ startVideoRecording(udid: string, outputFile: string, options?: VideoRecordingOptions): Promise<void>;
12
+ stopVideoRecording(udid: string): Promise<void>;
13
+ isVideoRecording(udid: string): Promise<boolean>;
14
+ }
15
+ }
16
+
17
+ const log = logger.getLogger('CoreSim');
18
+
19
+ // One device's recording lifecycle: `start` is the in-flight (or already-settled)
20
+ // startVideoRecording call, resolving to the live native handle — with both `options.audio` and
21
+ // `options.fps` unset, this addresses CoreSimulator's own internally-tracked private recorder (no
22
+ // real local resource, same as before this field existed); with either set, it's a real local
23
+ // resource (this addon's own encoders) with no server-side counterpart, so a handle is the only
24
+ // way to stop it either way. `stop`, once set, is the in-flight native stop call shared by every
25
+ // concurrent stopVideoRecording for this same recording — see stopVideoRecording for why a second
26
+ // one must reuse it rather than issuing its own.
27
+ interface RecordingState {
28
+ readonly start: Promise<NativeVideoRecordingHandle>;
29
+ stop?: Promise<void>;
30
+ }
31
+
32
+ // Tracks which devices currently have an active recording — module-level since the constraint (at
33
+ // most one per device) is CoreSimulator's own, not per-NativeSimctl-instance.
34
+ const activeRecordings = new Map<string, RecordingState>();
35
+
36
+ /**
37
+ * Starts recording the device's display (and, with `options.audio`, its audio too, muxed as a
38
+ * second track) to `outputFile` — the native equivalent of `simctl io <udid> recordVideo` when
39
+ * both `audio` and `fps` are unset. Resolves once the first frame has actually been recorded, so
40
+ * it's always safe to call {@link stopVideoRecording} immediately after. Only one recording may be
41
+ * active per device at a time; starting a second one while the first is still running rejects.
42
+ *
43
+ * Without `audio`/`fps`, rejects with `NativeSimUnavailableError` if this CoreSimulator predates
44
+ * the private capture API — confirmed missing on Xcode 16.4's, present on Xcode 26.5+ (Apple
45
+ * documents no exact version floor). With either set, see {@link VideoRecordingOptions.audio}'s
46
+ * own doc comment for the host-permission requirement that applies specifically to `audio`; a
47
+ * failure *after* this call has already resolved (e.g. the audio tap's guest process set vanishing
48
+ * mid-recording) doesn't reject it — it's logged here instead — call {@link stopVideoRecording} to
49
+ * observe it as a rejection and release the recording's resources.
50
+ *
51
+ * @param udid — UDID of the device to record; must be booted
52
+ * @param outputFile — filesystem path to write the video to; resolved against `process.cwd()` if
53
+ * relative, since the native layer requires an absolute path
54
+ * @param options — `displayId`, `codec`, `mask`, `audio`, `fps`, `bitrate` — see {@link VideoRecordingOptions}
55
+ * @throws {Error} if a recording is already in progress for this device
56
+ */
57
+ export async function startVideoRecording(
58
+ this: NativeSimctl,
59
+ udid: string,
60
+ outputFile: string,
61
+ options: VideoRecordingOptions = {},
62
+ ): Promise<void> {
63
+ // Mirrors startVideoStream's identical validation — both reach the same native encoder path,
64
+ // which otherwise silently truncates an out-of-range value instead of rejecting it.
65
+ if (options.fps !== undefined && (!Number.isFinite(options.fps) || options.fps < 1)) {
66
+ throw new RangeError(`fps must be a finite number >= 1, got ${options.fps}`);
67
+ }
68
+ if (
69
+ options.bitrate !== undefined &&
70
+ (!Number.isFinite(options.bitrate) || options.bitrate <= 0 || options.bitrate > 2 ** 31 - 1)
71
+ ) {
72
+ throw new RangeError(`bitrate must be a positive number no greater than ${2 ** 31 - 1}, got ${options.bitrate}`);
73
+ }
74
+ const key = udid.toLowerCase();
75
+ if (activeRecordings.has(key)) {
76
+ throw new Error(`A video recording is already in progress for device '${udid}'`);
77
+ }
78
+ const absoluteOutputFile = path.resolve(outputFile);
79
+ const startPromise = runCatchingAsync(async () =>
80
+ (await this._findDevice(udid)).startVideoRecording(absoluteOutputFile, options, (err) => {
81
+ // Only ever invoked on the `audio`/`fps` (own-encoder) path — see its own doc comment above.
82
+ // No live consumer to report to (this call already resolved), so logged instead of lost.
83
+ log.error(`Unhandled video recording error for device '${udid}': ${toTypedError(err).stack ?? err}`);
84
+ }),
85
+ );
86
+ // Marked before the native call resolves, not after, so a concurrent startVideoRecording for the
87
+ // same device is rejected immediately instead of racing this one — rolled back below on failure.
88
+ const state: RecordingState = {start: startPromise};
89
+ activeRecordings.set(key, state);
90
+ try {
91
+ await startPromise;
92
+ } catch (e) {
93
+ // Only clear our own entry — a concurrent stopVideoRecording (see below) may already have.
94
+ if (activeRecordings.get(key) === state) {
95
+ activeRecordings.delete(key);
96
+ }
97
+ throw e;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Stops a recording previously started by {@link startVideoRecording} on the same device.
103
+ * Resolves once the video file has been finalized on disk and is safe to read. If `start` is still
104
+ * in flight (e.g. a concurrent caller stopping as soon as {@link isVideoRecording} turns `true`),
105
+ * waits for it to settle first — issuing the native stop call any earlier is a silent CoreSimulator
106
+ * race (see CLAUDE.md).
107
+ *
108
+ * Safe to call concurrently or to retry after a failure: every concurrent call for the same
109
+ * recording shares a single in-flight native stop call rather than each issuing its own (which
110
+ * could otherwise stop whatever *new* recording has since started on this device instead), and a
111
+ * failed stop — even one that failed before ever reaching the native recorder, e.g. a transient
112
+ * device-lookup error — leaves the recording tracked as still active so a retry can reach the
113
+ * native call rather than the caller losing the ability to stop it at all.
114
+ *
115
+ * @param udid — UDID of the device to stop recording
116
+ * @throws {Error} if no recording is currently in progress for this device
117
+ */
118
+ export async function stopVideoRecording(this: NativeSimctl, udid: string): Promise<void> {
119
+ const key = udid.toLowerCase();
120
+ const state = activeRecordings.get(key);
121
+ if (!state) {
122
+ throw new Error(`No video recording is in progress for device '${udid}'`);
123
+ }
124
+ let handle: NativeVideoRecordingHandle;
125
+ try {
126
+ handle = await state.start;
127
+ } catch {
128
+ // start itself failed — its own catch already cleaned up activeRecordings; nothing to stop.
129
+ throw new Error(`No video recording is in progress for device '${udid}'`);
130
+ }
131
+ const stopPromise = (state.stop ??= runCatchingAsync(async () => {
132
+ await handle.stop();
133
+ }));
134
+ try {
135
+ await stopPromise;
136
+ } catch (e) {
137
+ // Only clear our own attempt, and only if it's still the current one — a future call must be
138
+ // able to retry the native stop rather than replaying this same rejection forever, but must
139
+ // not clobber a newer attempt another concurrent caller may have already started instead.
140
+ if (state.stop === stopPromise) {
141
+ state.stop = undefined;
142
+ }
143
+ throw e;
144
+ }
145
+ if (activeRecordings.get(key) === state) {
146
+ activeRecordings.delete(key);
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Whether a recording started by {@link startVideoRecording} is currently active for this device.
152
+ * Pure local state — no CoreSimulator dispatch — so this never rejects with a native error.
153
+ *
154
+ * @param udid — UDID of the device to check
155
+ */
156
+ export async function isVideoRecording(this: NativeSimctl, udid: string): Promise<boolean> {
157
+ return activeRecordings.has(udid.toLowerCase());
158
+ }