@appium/coresim 1.4.0 → 1.5.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [1.5.0](https://github.com/appium/coresim/compare/v1.4.0...v1.5.0) (2026-09-22)
2
+
3
+ ### Features
4
+
5
+ * Add video recording API ([#17](https://github.com/appium/coresim/issues/17)) ([d399403](https://github.com/appium/coresim/commit/d399403c1d329f303ab51726fa382313cf09ad0f))
6
+
1
7
  ## [1.4.0](https://github.com/appium/coresim/compare/v1.3.0...v1.4.0) (2026-09-19)
2
8
 
3
9
  ### Features
package/binding.gyp CHANGED
@@ -13,7 +13,9 @@
13
13
  "src/native/tcc_privacy.mm",
14
14
  "src/native/sim_pasteboard.mm",
15
15
  "src/native/sim_process.mm",
16
- "src/native/sim_screenshot.mm"
16
+ "src/native/sim_screenshot.mm",
17
+ "src/native/sim_video_recording.mm",
18
+ "src/native/sim_video_stream.mm"
17
19
  ],
18
20
  "include_dirs": [
19
21
  "<!@(node -p \"require('node-addon-api').include\")"
@@ -42,9 +44,13 @@
42
44
  "OTHER_LDFLAGS": [
43
45
  "-framework", "Foundation",
44
46
  "-framework", "AppKit",
47
+ "-framework", "AVFoundation",
45
48
  "-framework", "CoreImage",
49
+ "-framework", "CoreMedia",
50
+ "-framework", "CoreVideo",
46
51
  "-framework", "ImageIO",
47
52
  "-framework", "IOSurface",
53
+ "-framework", "VideoToolbox",
48
54
  "-lsqlite3"
49
55
  ]
50
56
  }
@@ -0,0 +1,50 @@
1
+ import type { NativeSimctl } from '../native-simctl.js';
2
+ import type { VideoRecordingOptions } from '../types.js';
3
+ declare module '../native-simctl.js' {
4
+ interface NativeSimctl {
5
+ startVideoRecording(udid: string, outputFile: string, options?: VideoRecordingOptions): Promise<void>;
6
+ stopVideoRecording(udid: string): Promise<void>;
7
+ isVideoRecording(udid: string): Promise<boolean>;
8
+ }
9
+ }
10
+ /**
11
+ * Starts recording the device's display to `outputFile` — the native equivalent of `simctl io
12
+ * <udid> recordVideo`. Resolves once the first frame has actually been recorded, so it's always
13
+ * safe to call {@link stopVideoRecording} immediately after. Only one recording may be active per
14
+ * device at a time; starting a second one while the first is still running rejects. Rejects with
15
+ * `NativeSimUnavailableError` if this CoreSimulator predates the private capture API — confirmed
16
+ * missing on Xcode 16.4's, present on Xcode 26.5+ (Apple documents no exact version floor).
17
+ *
18
+ * @param udid — UDID of the device to record; must be booted
19
+ * @param outputFile — filesystem path to write the video to; resolved against `process.cwd()` if
20
+ * relative, since the native layer requires an absolute path
21
+ * @param options — `displayId`, `codec`, `mask` — see {@link VideoRecordingOptions}
22
+ * @throws {Error} if a recording is already in progress for this device
23
+ */
24
+ export declare function startVideoRecording(this: NativeSimctl, udid: string, outputFile: string, options?: VideoRecordingOptions): Promise<void>;
25
+ /**
26
+ * Stops a recording previously started by {@link startVideoRecording} on the same device.
27
+ * Resolves once the video file has been finalized on disk and is safe to read. If `start` is still
28
+ * in flight (e.g. a concurrent caller stopping as soon as {@link isVideoRecording} turns `true`),
29
+ * waits for it to settle first — issuing the native stop call any earlier is a silent CoreSimulator
30
+ * race (see CLAUDE.md).
31
+ *
32
+ * Safe to call concurrently or to retry after a failure: every concurrent call for the same
33
+ * recording shares a single in-flight native stop call rather than each issuing its own (which
34
+ * could otherwise stop whatever *new* recording has since started on this device instead), and a
35
+ * failed stop — even one that failed before ever reaching the native recorder, e.g. a transient
36
+ * device-lookup error — leaves the recording tracked as still active so a retry can reach the
37
+ * native call rather than the caller losing the ability to stop it at all.
38
+ *
39
+ * @param udid — UDID of the device to stop recording
40
+ * @throws {Error} if no recording is currently in progress for this device
41
+ */
42
+ export declare function stopVideoRecording(this: NativeSimctl, udid: string): Promise<void>;
43
+ /**
44
+ * Whether a recording started by {@link startVideoRecording} is currently active for this device.
45
+ * Pure local state — no CoreSimulator dispatch — so this never rejects with a native error.
46
+ *
47
+ * @param udid — UDID of the device to check
48
+ */
49
+ export declare function isVideoRecording(this: NativeSimctl, udid: string): Promise<boolean>;
50
+ //# sourceMappingURL=video-recording.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-recording.d.ts","sourceRoot":"","sources":["../../../src/commands/video-recording.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAGvD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACtG,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAChD,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KAClD;CACF;AAgBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BxF;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEzF"}
@@ -0,0 +1,98 @@
1
+ import path from 'node:path';
2
+ import { runCatchingAsync } from '../utils/index.js';
3
+ // Tracks which devices currently have an active recording — module-level since the constraint (at
4
+ // most one per device) is CoreSimulator's own, not per-NativeSimctl-instance.
5
+ const activeRecordings = new Map();
6
+ /**
7
+ * Starts recording the device's display to `outputFile` — the native equivalent of `simctl io
8
+ * <udid> recordVideo`. Resolves once the first frame has actually been recorded, so it's always
9
+ * safe to call {@link stopVideoRecording} immediately after. Only one recording may be active per
10
+ * device at a time; starting a second one while the first is still running rejects. Rejects with
11
+ * `NativeSimUnavailableError` if this CoreSimulator predates the private capture API — confirmed
12
+ * missing on Xcode 16.4's, present on Xcode 26.5+ (Apple documents no exact version floor).
13
+ *
14
+ * @param udid — UDID of the device to record; must be booted
15
+ * @param outputFile — filesystem path to write the video to; resolved against `process.cwd()` if
16
+ * relative, since the native layer requires an absolute path
17
+ * @param options — `displayId`, `codec`, `mask` — see {@link VideoRecordingOptions}
18
+ * @throws {Error} if a recording is already in progress for this device
19
+ */
20
+ export async function startVideoRecording(udid, outputFile, options = {}) {
21
+ const key = udid.toLowerCase();
22
+ if (activeRecordings.has(key)) {
23
+ throw new Error(`A video recording is already in progress for device '${udid}'`);
24
+ }
25
+ const absoluteOutputFile = path.resolve(outputFile);
26
+ const startPromise = runCatchingAsync(async () => (await this._findDevice(udid)).startVideoRecording(absoluteOutputFile, options));
27
+ // Marked before the native call resolves, not after, so a concurrent startVideoRecording for the
28
+ // same device is rejected immediately instead of racing this one — rolled back below on failure.
29
+ const state = { start: startPromise };
30
+ activeRecordings.set(key, state);
31
+ try {
32
+ await startPromise;
33
+ }
34
+ catch (e) {
35
+ // Only clear our own entry — a concurrent stopVideoRecording (see below) may already have.
36
+ if (activeRecordings.get(key) === state) {
37
+ activeRecordings.delete(key);
38
+ }
39
+ throw e;
40
+ }
41
+ }
42
+ /**
43
+ * Stops a recording previously started by {@link startVideoRecording} on the same device.
44
+ * Resolves once the video file has been finalized on disk and is safe to read. If `start` is still
45
+ * in flight (e.g. a concurrent caller stopping as soon as {@link isVideoRecording} turns `true`),
46
+ * waits for it to settle first — issuing the native stop call any earlier is a silent CoreSimulator
47
+ * race (see CLAUDE.md).
48
+ *
49
+ * Safe to call concurrently or to retry after a failure: every concurrent call for the same
50
+ * recording shares a single in-flight native stop call rather than each issuing its own (which
51
+ * could otherwise stop whatever *new* recording has since started on this device instead), and a
52
+ * failed stop — even one that failed before ever reaching the native recorder, e.g. a transient
53
+ * device-lookup error — leaves the recording tracked as still active so a retry can reach the
54
+ * native call rather than the caller losing the ability to stop it at all.
55
+ *
56
+ * @param udid — UDID of the device to stop recording
57
+ * @throws {Error} if no recording is currently in progress for this device
58
+ */
59
+ export async function stopVideoRecording(udid) {
60
+ const key = udid.toLowerCase();
61
+ const state = activeRecordings.get(key);
62
+ if (!state) {
63
+ throw new Error(`No video recording is in progress for device '${udid}'`);
64
+ }
65
+ try {
66
+ await state.start;
67
+ }
68
+ catch {
69
+ // start itself failed — its own catch already cleaned up activeRecordings; nothing to stop.
70
+ throw new Error(`No video recording is in progress for device '${udid}'`);
71
+ }
72
+ const stopPromise = (state.stop ??= runCatchingAsync(async () => (await this._findDevice(udid)).stopVideoRecording()));
73
+ try {
74
+ await stopPromise;
75
+ }
76
+ catch (e) {
77
+ // Only clear our own attempt, and only if it's still the current one — a future call must be
78
+ // able to retry the native stop rather than replaying this same rejection forever, but must
79
+ // not clobber a newer attempt another concurrent caller may have already started instead.
80
+ if (state.stop === stopPromise) {
81
+ state.stop = undefined;
82
+ }
83
+ throw e;
84
+ }
85
+ if (activeRecordings.get(key) === state) {
86
+ activeRecordings.delete(key);
87
+ }
88
+ }
89
+ /**
90
+ * Whether a recording started by {@link startVideoRecording} is currently active for this device.
91
+ * Pure local state — no CoreSimulator dispatch — so this never rejects with a native error.
92
+ *
93
+ * @param udid — UDID of the device to check
94
+ */
95
+ export async function isVideoRecording(udid) {
96
+ return activeRecordings.has(udid.toLowerCase());
97
+ }
98
+ //# sourceMappingURL=video-recording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-recording.js","sourceRoot":"","sources":["../../../src/commands/video-recording.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;A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ideoStreamOptions } from '../types.js';
4
+ declare module '../native-simctl.js' {
5
+ interface NativeSimctl {
6
+ startVideoStream(udid: string, options?: VideoStreamOptions): Promise<VideoStream>;
7
+ }
8
+ }
9
+ /**
10
+ * A live video stream from `NativeSimctl.startVideoStream` — encodes the device's display in real
11
+ * time via VideoToolbox, unlike `startVideoRecording`, which drives CoreSimulator's own private,
12
+ * file-only recorder. Mirrors `appium-ios-remotexpc`'s `ScreenStreamCapture` shape
13
+ * (`accessUnits()`/`stop()`) for API consistency; the transport is otherwise unrelated.
14
+ */
15
+ export declare class VideoStream extends EventEmitter {
16
+ readonly codec: 'h264' | 'hevc';
17
+ private handle;
18
+ private readonly stopController;
19
+ private stopPromise;
20
+ private readonly queue;
21
+ private activeConsumers;
22
+ /**
23
+ * Yields each encoded access unit as it's produced, until {@link stop} is called or the stream
24
+ * errors (in which case the error is thrown out of the loop). Pass `signal` to stop iterating
25
+ * without treating that as an error. Mirrors `ScreenStreamCapture.accessUnits()`'s shape.
26
+ *
27
+ * Only one active consumer is supported at a time — a second concurrent call rejects rather
28
+ * than silently sharing (and corrupting) the first one's single internal waiter slot.
29
+ */
30
+ accessUnits(signal?: AbortSignal): AsyncGenerator<VideoAccessUnit>;
31
+ /** Stops the stream and releases the underlying encoder. Idempotent, including concurrently. */
32
+ stop(): Promise<void>;
33
+ }
34
+ /**
35
+ * Starts encoding the device's display in real time. Resolves once the encoder has actually
36
+ * started; the returned {@link VideoStream}'s `accessUnits()` then yields each frame as it
37
+ * arrives. Independent of `startVideoRecording`/`stopVideoRecording` — both, and any number of
38
+ * concurrent streams, can run on the same device at once.
39
+ *
40
+ * @param udid — UDID of the device to stream; must be booted
41
+ * @param options — `displayId`, `codec`, `fps`, `bitrate` — see {@link VideoStreamOptions}
42
+ */
43
+ export declare function startVideoStream(this: NativeSimctl, udid: string, options?: VideoStreamOptions): Promise<VideoStream>;
44
+ //# sourceMappingURL=video-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-stream.d.ts","sourceRoot":"","sources":["../../../src/commands/video-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAKzC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAA0B,eAAe,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAG9F,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;KACpF;CACF;AA2ID;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,YAAY;aAWf,KAAK,EAAE,MAAM,GAAG,MAAM;IAVlD,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyB;IACxD,OAAO,CAAC,WAAW,CAA4B;IAI/C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6D;IACnF,OAAO,CAAC,eAAe,CAAK;IAiC5B;;;;;;;OAOG;IACI,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC,eAAe,CAAC;IAmBzE,gGAAgG;IAC1F,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ5B;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,WAAW,CAAC,CAuBtB"}
@@ -0,0 +1,240 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import { logger } from '@appium/support';
3
+ import { wrapNativeError } from '../errors.js';
4
+ import { runCatchingAsync } from '../utils/index.js';
5
+ const log = logger.getLogger('CoreSim');
6
+ // Matches the native side's own ThreadSafeFunction queue bound (see coresim.mm's
7
+ // kAccessUnitQueueSize) — kept here too since the native bound alone provides no real
8
+ // backpressure: _handleAccessUnit's emit-equivalent push always returns immediately, regardless of
9
+ // how slow the actual accessUnits() consumer is, so without a bound of its own this queue could
10
+ // otherwise grow without limit while a slow consumer falls behind.
11
+ const MAX_BUFFERED_UNITS = 60;
12
+ const SINGLE_CONSUMER_ERROR = 'VideoStream.accessUnits() supports only one active consumer at a time — a second concurrent call rejects.';
13
+ /** `wrapNativeError` always throws — this just gets its thrown value back as a plain return, to emit rather than raise it. */
14
+ function toTypedError(err) {
15
+ try {
16
+ wrapNativeError(err);
17
+ }
18
+ catch (wrapped) {
19
+ return wrapped;
20
+ }
21
+ }
22
+ /**
23
+ * Single-consumer FIFO between native's per-frame callback and `accessUnits()`. Unlike routing
24
+ * through `EventEmitter`, a unit pushed before any consumer has started iterating is retained
25
+ * (fixing the encoder's own first-frame/keyframe otherwise being lost to a startup race) rather
26
+ * than silently dropped.
27
+ *
28
+ * Bounded at `MAX_BUFFERED_UNITS`, but codec-aware about *how* it sheds load once a slow consumer
29
+ * falls behind: since frames only reference earlier frames they were encoded against (no
30
+ * `AllowFrameReordering`), dropping an arbitrary interframe would orphan every later one from its
31
+ * reference chain, corrupting decode from that point on even though delivery looks unbroken.
32
+ * Overflow instead clears the backlog entirely and enters a resync state, discarding every
33
+ * further interframe (not buffering them) until the next keyframe — self-decodable on its own —
34
+ * lets delivery resume cleanly.
35
+ */
36
+ class AccessUnitQueue {
37
+ onOverflow;
38
+ buffer = [];
39
+ waiter;
40
+ ended = false;
41
+ error;
42
+ resyncing = false;
43
+ /** @param onOverflow — called once when overflow first forces a resync, e.g. to request a fresh keyframe. */
44
+ constructor(onOverflow) {
45
+ this.onOverflow = onOverflow;
46
+ }
47
+ push(unit) {
48
+ if (this.ended) {
49
+ return;
50
+ }
51
+ if (this.resyncing) {
52
+ if (!unit.isKeyFrame) {
53
+ return; // still waiting for a self-decodable point to resume delivery from
54
+ }
55
+ this.resyncing = false;
56
+ }
57
+ if (this.waiter) {
58
+ const { resolve } = this.waiter;
59
+ this.waiter = undefined;
60
+ resolve({ value: unit, done: false });
61
+ return;
62
+ }
63
+ this.buffer.push(unit);
64
+ if (this.buffer.length > MAX_BUFFERED_UNITS) {
65
+ this.buffer.length = 0;
66
+ this.resyncing = true;
67
+ this.onOverflow?.();
68
+ }
69
+ }
70
+ /** Ends the queue with an error — any pending or future `next()` rejects with it. */
71
+ fail(err) {
72
+ if (this.ended) {
73
+ return;
74
+ }
75
+ this.ended = true;
76
+ this.error = err;
77
+ this.buffer.length = 0;
78
+ if (this.waiter) {
79
+ const { reject } = this.waiter;
80
+ this.waiter = undefined;
81
+ reject(err);
82
+ }
83
+ }
84
+ /** Ends the queue cleanly — any pending or future `next()` resolves `done`. */
85
+ end() {
86
+ if (this.ended) {
87
+ return;
88
+ }
89
+ this.ended = true;
90
+ this.buffer.length = 0;
91
+ if (this.waiter) {
92
+ const { resolve } = this.waiter;
93
+ this.waiter = undefined;
94
+ resolve({ value: undefined, done: true });
95
+ }
96
+ }
97
+ /**
98
+ * Resolves `done` (not rejects) if `signal` aborts while waiting, mirroring `events.on()`.
99
+ * Checks cancellation/end *before* dequeuing, so an already-aborted signal or an already-ended
100
+ * queue never hands out a stale buffered unit — an aborted consumer, or a fresh iterator started
101
+ * after `stop()`, must see the boundary immediately rather than draining leftovers first.
102
+ */
103
+ next(signal) {
104
+ if (signal.aborted) {
105
+ return Promise.resolve({ value: undefined, done: true });
106
+ }
107
+ if (this.ended) {
108
+ return this.error ? Promise.reject(this.error) : Promise.resolve({ value: undefined, done: true });
109
+ }
110
+ const buffered = this.buffer.shift();
111
+ if (buffered !== undefined) {
112
+ return Promise.resolve({ value: buffered, done: false });
113
+ }
114
+ return new Promise((resolve, reject) => {
115
+ const onAbort = () => {
116
+ this.waiter = undefined;
117
+ resolve({ value: undefined, done: true });
118
+ };
119
+ signal.addEventListener('abort', onAbort, { once: true });
120
+ this.waiter = {
121
+ resolve: (result) => {
122
+ signal.removeEventListener('abort', onAbort);
123
+ resolve(result);
124
+ },
125
+ reject: (err) => {
126
+ signal.removeEventListener('abort', onAbort);
127
+ reject(err);
128
+ },
129
+ };
130
+ });
131
+ }
132
+ }
133
+ /**
134
+ * A live video stream from `NativeSimctl.startVideoStream` — encodes the device's display in real
135
+ * time via VideoToolbox, unlike `startVideoRecording`, which drives CoreSimulator's own private,
136
+ * file-only recorder. Mirrors `appium-ios-remotexpc`'s `ScreenStreamCapture` shape
137
+ * (`accessUnits()`/`stop()`) for API consistency; the transport is otherwise unrelated.
138
+ */
139
+ export class VideoStream extends EventEmitter {
140
+ codec;
141
+ handle;
142
+ stopController = new AbortController();
143
+ stopPromise;
144
+ // Requests a fresh keyframe on resync so delivery can resume immediately rather than waiting
145
+ // for the next periodic one — `handle` may not be attached yet on a startup-time overflow
146
+ // (vanishingly unlikely given MAX_BUFFERED_UNITS), in which case this is just a no-op.
147
+ queue = new AccessUnitQueue(() => this.handle?.requestKeyFrame());
148
+ activeConsumers = 0;
149
+ /** @internal */
150
+ constructor(codec) {
151
+ super();
152
+ this.codec = codec;
153
+ }
154
+ /** @internal */
155
+ _handleAccessUnit(unit) {
156
+ this.queue.push(unit);
157
+ }
158
+ /**
159
+ * @internal
160
+ * An active `accessUnits()` consumer receives the error via the queue itself (thrown out of its
161
+ * `for await` loop, per that method's contract) rather than the `'error'` event, so `emit` is
162
+ * only used for an explicit external listener; with neither, it's logged instead of lost.
163
+ */
164
+ _handleError(err) {
165
+ const error = toTypedError(err);
166
+ this.queue.fail(error);
167
+ if (this.listenerCount('error') > 0) {
168
+ this.emit('error', error);
169
+ }
170
+ else if (this.activeConsumers === 0) {
171
+ log.error(`Unhandled VideoStream error: ${error.stack ?? error}`);
172
+ }
173
+ }
174
+ /** @internal */
175
+ _attachHandle(handle) {
176
+ this.handle = handle;
177
+ }
178
+ /**
179
+ * Yields each encoded access unit as it's produced, until {@link stop} is called or the stream
180
+ * errors (in which case the error is thrown out of the loop). Pass `signal` to stop iterating
181
+ * without treating that as an error. Mirrors `ScreenStreamCapture.accessUnits()`'s shape.
182
+ *
183
+ * Only one active consumer is supported at a time — a second concurrent call rejects rather
184
+ * than silently sharing (and corrupting) the first one's single internal waiter slot.
185
+ */
186
+ async *accessUnits(signal) {
187
+ if (this.activeConsumers > 0) {
188
+ throw new Error(SINGLE_CONSUMER_ERROR);
189
+ }
190
+ const combined = signal ? AbortSignal.any([signal, this.stopController.signal]) : this.stopController.signal;
191
+ this.activeConsumers++;
192
+ try {
193
+ for (;;) {
194
+ const result = await this.queue.next(combined);
195
+ if (result.done) {
196
+ return;
197
+ }
198
+ yield result.value;
199
+ }
200
+ }
201
+ finally {
202
+ this.activeConsumers--;
203
+ }
204
+ }
205
+ /** Stops the stream and releases the underlying encoder. Idempotent, including concurrently. */
206
+ async stop() {
207
+ this.stopPromise ??= (async () => {
208
+ this.stopController.abort();
209
+ this.queue.end();
210
+ await this.handle?.stop();
211
+ })();
212
+ return this.stopPromise;
213
+ }
214
+ }
215
+ /**
216
+ * Starts encoding the device's display in real time. Resolves once the encoder has actually
217
+ * started; the returned {@link VideoStream}'s `accessUnits()` then yields each frame as it
218
+ * arrives. Independent of `startVideoRecording`/`stopVideoRecording` — both, and any number of
219
+ * concurrent streams, can run on the same device at once.
220
+ *
221
+ * @param udid — UDID of the device to stream; must be booted
222
+ * @param options — `displayId`, `codec`, `fps`, `bitrate` — see {@link VideoStreamOptions}
223
+ */
224
+ export async function startVideoStream(udid, options = {}) {
225
+ // The native poller clamps below 1 fps to 1 fps rather than actually polling that slowly, so a
226
+ // sub-1 value here would silently poll far more often than requested — rejected instead.
227
+ if (options.fps !== undefined && (!Number.isFinite(options.fps) || options.fps < 1)) {
228
+ throw new RangeError(`fps must be a finite number >= 1, got ${options.fps}`);
229
+ }
230
+ if (options.bitrate !== undefined &&
231
+ (!Number.isFinite(options.bitrate) || options.bitrate <= 0 || options.bitrate > 2 ** 31 - 1)) {
232
+ throw new RangeError(`bitrate must be a positive number no greater than ${2 ** 31 - 1}, got ${options.bitrate}`);
233
+ }
234
+ const device = await runCatchingAsync(() => this._findDevice(udid));
235
+ const stream = new VideoStream(options.codec === 'hevc' ? 'hevc' : 'h264');
236
+ const handle = await runCatchingAsync(() => device.startVideoStream(options, (unit) => stream._handleAccessUnit(unit), (err) => stream._handleError(err)));
237
+ stream._attachHandle(handle);
238
+ return stream;
239
+ }
240
+ //# sourceMappingURL=video-stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-stream.js","sourceRoot":"","sources":["../../../src/commands/video-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAQnD,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAExC,iFAAiF;AACjF,sFAAsF;AACtF,mGAAmG;AACnG,gGAAgG;AAChG,mEAAmE;AACnE,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,MAAM,qBAAqB,GACzB,2GAA2G,CAAC;AAE9G,8HAA8H;AAC9H,SAAS,YAAY,CAAC,GAAY;IAChC,IAAI,CAAC;QACH,eAAe,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAAC,OAAO,OAAO,EAAE,CAAC;QACjB,OAAO,OAAgB,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,eAAe;IAUU;IATZ,MAAM,GAAsB,EAAE,CAAC;IACxC,MAAM,CAEA;IACN,KAAK,GAAG,KAAK,CAAC;IACd,KAAK,CAAU;IACf,SAAS,GAAG,KAAK,CAAC;IAE1B,6GAA6G;IAC7G,YAA6B,UAAuB;QAAvB,eAAU,GAAV,UAAU,CAAa;IAAG,CAAC;IAExD,IAAI,CAAC,IAAqB;QACxB,IAAI,IAAI,CAAC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AC;IAC3E,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,CACzC,MAAM,CAAC,gBAAgB,CACrB,OAAO,EACP,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,EACxC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAClC,CACF,CAAC;IACF,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  export { NativeSimError, NativeSimUnavailableError, NativeSimDispatchError, NativeSimOperationError } from './errors.js';
2
2
  export { NativeSimctl } from './native-simctl.js';
3
3
  export { SpawnedProcess } from './commands/spawn.js';
4
+ export { VideoStream } from './commands/video-stream.js';
4
5
  export type { AppContainerType } from './commands/app.js';
5
6
  export type { BiometricName } from './commands/biometric.js';
6
- export { SimBootStatus, SimDeviceState, type ApnsAlert, type ApnsPayload, type ApnsSound, type PushNotificationPayload, type ScreenshotOptions, type SimBootInfo, type SimDeviceInfo, type SimDeviceTypeInfo, type SimDisplayInfo, type SimPermissionService, type SimPermissionStatus, type SimProcessInfo, type SimRuntimeInfo, type SpawnOptions, } from './types.js';
7
+ export { SimBootStatus, SimDeviceState, type ApnsAlert, type ApnsPayload, type ApnsSound, type PushNotificationPayload, type ScreenshotOptions, type SimBootInfo, type SimDeviceInfo, type SimDeviceTypeInfo, type SimDisplayInfo, type SimPermissionService, type SimPermissionStatus, type SimProcessInfo, type SimRuntimeInfo, type SpawnOptions, type VideoAccessUnit, type VideoRecordingOptions, type VideoStreamOptions, } from './types.js';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,uBAAuB,EAAC,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cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC"}
package/lib/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { NativeSimError, NativeSimUnavailableError, NativeSimDispatchError, NativeSimOperationError } from './errors.js';
2
2
  export { NativeSimctl } from './native-simctl.js';
3
3
  export { SpawnedProcess } from './commands/spawn.js';
4
+ export { VideoStream } from './commands/video-stream.js';
4
5
  export { SimBootStatus, SimDeviceState, } from './types.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -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,0BAA0B,CAAC;AAClC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,4BAA4B,CAAC;AAYpC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAY;IAYrB,OAAO,CAA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,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
@@ -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,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AACjG,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAC,MAAM,2BAA2B,CAAC;AACxG,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACzF,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,EACb,UAAU,EACV,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC5G,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,uB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