@appium/coresim 1.11.0 → 1.12.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 +14 -0
- package/README.md +6 -1
- package/lib/src/commands/jpeg-stream.d.ts +2 -0
- package/lib/src/commands/jpeg-stream.d.ts.map +1 -1
- package/lib/src/commands/jpeg-stream.js +6 -2
- package/lib/src/commands/jpeg-stream.js.map +1 -1
- package/lib/src/commands/screenshot.d.ts +3 -3
- package/lib/src/commands/screenshot.d.ts.map +1 -1
- package/lib/src/commands/screenshot.js +10 -5
- package/lib/src/commands/screenshot.js.map +1 -1
- package/lib/src/commands/video-recording.d.ts +2 -0
- package/lib/src/commands/video-recording.d.ts.map +1 -1
- package/lib/src/commands/video-recording.js +13 -6
- package/lib/src/commands/video-recording.js.map +1 -1
- package/lib/src/commands/video-stream.d.ts +2 -0
- package/lib/src/commands/video-stream.d.ts.map +1 -1
- package/lib/src/commands/video-stream.js +6 -2
- package/lib/src/commands/video-stream.js.map +1 -1
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/types.d.ts +19 -27
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/utils/display.d.ts +24 -0
- package/lib/src/utils/display.d.ts.map +1 -0
- package/lib/src/utils/display.js +55 -0
- package/lib/src/utils/display.js.map +1 -0
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/index.js +1 -0
- package/lib/src/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/prebuilds/darwin-arm64/@appium+coresim.node +0 -0
- package/src/commands/jpeg-stream.ts +6 -2
- package/src/commands/screenshot.ts +10 -5
- package/src/commands/video-recording.ts +10 -5
- package/src/commands/video-stream.ts +6 -2
- package/src/index.ts +2 -0
- package/src/native/sim_screenshot.h +12 -7
- package/src/native/sim_screenshot.mm +22 -6
- package/src/types.ts +21 -27
- package/src/utils/display.ts +67 -0
- package/src/utils/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.12.0](https://github.com/appium/appium-ios/compare/@appium/coresim@1.11.1...@appium/coresim@1.12.0) (2026-10-12)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* support numeric display IDs across capture APIs ([#49](https://github.com/appium/appium-ios/issues/49)) ([ca7649a](https://github.com/appium/appium-ios/commit/ca7649addf546a023bc0d601f784f801b8d99b56))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [1.11.1](https://github.com/appium/appium-ios/compare/@appium/coresim@1.11.0...@appium/coresim@1.11.1) (2026-10-05)
|
|
14
|
+
|
|
15
|
+
### Performance Improvements
|
|
16
|
+
|
|
17
|
+
* **coresim:** reuse one CIContext across getScreenshot calls ([#44](https://github.com/appium/appium-ios/issues/44)) ([ecf353b](https://github.com/appium/appium-ios/commit/ecf353bad640c43c85cf8fa26cb7759b8a9570a0))
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
## [1.11.0](https://github.com/appium/appium-ios/compare/@appium/coresim@1.10.2...@appium/coresim@1.11.0) (2026-10-03)
|
|
7
21
|
|
|
8
22
|
### Features
|
package/README.md
CHANGED
|
@@ -58,7 +58,12 @@ await sim.deleteDevice(device.udid);
|
|
|
58
58
|
and a real-time JPEG frame stream (`startJpegStream` — configurable fps/quality, no video codec
|
|
59
59
|
involved, meant for callers building their own MJPEG stream out of the frame sequence) —
|
|
60
60
|
optionally with the device's own audio, muxed into the recording or interleaved into the video
|
|
61
|
-
stream (`audio: true` on `startVideoRecording`/`startVideoStream`).
|
|
61
|
+
stream (`audio: true` on `startVideoRecording`/`startVideoStream`). All four capture APIs accept
|
|
62
|
+
a port UUID or a numeric XCTest/WDA guest screen ID as `displayId`. Numeric IDs are resolved against the current ports
|
|
63
|
+
on each screenshot or once at recording/stream startup. Missing or ambiguous IDs reject.
|
|
64
|
+
Without an ID, a unique class-0 display is selected; if none exists, native selection falls
|
|
65
|
+
back to the first renderable display. Multiple class-0 displays (such as Duo) require an
|
|
66
|
+
explicit ID. Audio capture requires:
|
|
62
67
|
- **macOS 14.2+** on the host (Core Audio process taps).
|
|
63
68
|
- The host's **"System Audio Recording Only"** privacy permission (System Settings > Privacy &
|
|
64
69
|
Security > Screen & System Audio Recording). This can't be granted programmatically, and a
|
|
@@ -37,6 +37,8 @@ export declare class JpegStream extends EventEmitter {
|
|
|
37
37
|
* each frame as it arrives. Independent of `startVideoStream`/`startVideoRecording` — any number of
|
|
38
38
|
* concurrent streams/recordings can run on the same device at once.
|
|
39
39
|
*
|
|
40
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
41
|
+
*
|
|
40
42
|
* @param udid — UDID of the device to stream; must be booted
|
|
41
43
|
* @param options — `displayId`, `fps`, `quality`, `scale` — see {@link JpegStreamOptions}
|
|
42
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jpeg-stream.d.ts","sourceRoot":"","sources":["../../../src/commands/jpeg-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAIzC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,SAAS,EAAE,iBAAiB,EAAyB,MAAM,aAAa,CAAC;AAGtF,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;KACjF;CACF;AAuGD;;;;;;GAMG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,MAAM,CAA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,EAAE,MAAM,EACZ,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,CA4BrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { logger } from '@appium/support';
|
|
3
|
-
import { runCatchingAsync, toTypedError } from '../utils/index.js';
|
|
3
|
+
import { resolveDisplayPortId, runCatchingAsync, toTypedError, validateDisplayId } from '../utils/index.js';
|
|
4
4
|
const log = logger.getLogger('CoreSim');
|
|
5
5
|
// Matches the native side's own ThreadSafeFunction queue bound (see coresim.mm's kFrameQueueSize).
|
|
6
6
|
const MAX_BUFFERED_FRAMES = 60;
|
|
@@ -173,6 +173,8 @@ export class JpegStream extends EventEmitter {
|
|
|
173
173
|
* each frame as it arrives. Independent of `startVideoStream`/`startVideoRecording` — any number of
|
|
174
174
|
* concurrent streams/recordings can run on the same device at once.
|
|
175
175
|
*
|
|
176
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
177
|
+
*
|
|
176
178
|
* @param udid — UDID of the device to stream; must be booted
|
|
177
179
|
* @param options — `displayId`, `fps`, `quality`, `scale` — see {@link JpegStreamOptions}
|
|
178
180
|
*/
|
|
@@ -189,9 +191,11 @@ export async function startJpegStream(udid, options = {}) {
|
|
|
189
191
|
if (options.scale !== undefined && (!Number.isFinite(options.scale) || options.scale <= 0 || options.scale > 100)) {
|
|
190
192
|
throw new RangeError(`scale must be a number greater than 0 and no greater than 100, got ${options.scale}`);
|
|
191
193
|
}
|
|
194
|
+
validateDisplayId(options.displayId);
|
|
192
195
|
const device = await runCatchingAsync(() => this._findDevice(udid));
|
|
196
|
+
const displayId = await runCatchingAsync(() => resolveDisplayPortId(device, options.displayId));
|
|
193
197
|
const stream = new JpegStream();
|
|
194
|
-
const handle = await runCatchingAsync(() => device.startJpegStream(options, (frame) => stream._handleFrame(frame), (err) => stream._handleError(err)));
|
|
198
|
+
const handle = await runCatchingAsync(() => device.startJpegStream({ ...options, displayId }, (frame) => stream._handleFrame(frame), (err) => stream._handleError(err)));
|
|
195
199
|
stream._attachHandle(handle);
|
|
196
200
|
return stream;
|
|
197
201
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jpeg-stream.js","sourceRoot":"","sources":["../../../src/commands/jpeg-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAIvC,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"jpeg-stream.js","sourceRoot":"","sources":["../../../src/commands/jpeg-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAIvC,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAQ1G,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAExC,mGAAmG;AACnG,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,MAAM,qBAAqB,GACzB,qGAAqG,CAAC;AAExG;;;;;GAKG;AACH,MAAM,cAAc;IACD,MAAM,GAAgB,EAAE,CAAC;IAClC,MAAM,CAAqG;IAC3G,KAAK,GAAG,KAAK,CAAC;IACd,KAAK,CAAU;IAEvB,IAAI,CAAC,KAAgB;QACnB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,EAAC,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAC;YAC9B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YACxB,OAAO,CAAC,EAAC,KA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9,11 +9,11 @@ declare module '../native-simctl.js' {
|
|
|
9
9
|
/**
|
|
10
10
|
* Captures a device display as an image — the native equivalent of `simctl io <udid> screenshot`
|
|
11
11
|
* (see native/sim_screenshot.mm for how this reads the framebuffer directly, with no temp file or
|
|
12
|
-
* subprocess). Rejects if the resolved display has no renderable surface yet (e.g. not booted)
|
|
13
|
-
*
|
|
12
|
+
* subprocess). Rejects if the resolved display has no renderable surface yet (e.g. not booted).
|
|
13
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
14
14
|
*
|
|
15
15
|
* @param udid — UDID of the device to capture; must be booted
|
|
16
|
-
* @param options — `format` (defaults to `'png'`), `displayId
|
|
16
|
+
* @param options — `format` (defaults to `'png'`), `displayId`,
|
|
17
17
|
* and `quality` (JPEG only, 0-100 percent)
|
|
18
18
|
* @returns image data encoded as `options.format`
|
|
19
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/screenshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAGnE,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1E,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;KACtD;CACF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/screenshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAGnE,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1E,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;KACtD;CACF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAajB;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAE7F"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { runCatchingAsync } from '../utils/index.js';
|
|
1
|
+
import { resolveDisplayPortId, runCatchingAsync, validateDisplayId } from '../utils/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Captures a device display as an image — the native equivalent of `simctl io <udid> screenshot`
|
|
4
4
|
* (see native/sim_screenshot.mm for how this reads the framebuffer directly, with no temp file or
|
|
5
|
-
* subprocess). Rejects if the resolved display has no renderable surface yet (e.g. not booted)
|
|
6
|
-
*
|
|
5
|
+
* subprocess). Rejects if the resolved display has no renderable surface yet (e.g. not booted).
|
|
6
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
7
7
|
*
|
|
8
8
|
* @param udid — UDID of the device to capture; must be booted
|
|
9
|
-
* @param options — `format` (defaults to `'png'`), `displayId
|
|
9
|
+
* @param options — `format` (defaults to `'png'`), `displayId`,
|
|
10
10
|
* and `quality` (JPEG only, 0-100 percent)
|
|
11
11
|
* @returns image data encoded as `options.format`
|
|
12
12
|
*/
|
|
@@ -15,7 +15,12 @@ export async function getScreenshot(udid, options = {}) {
|
|
|
15
15
|
(!Number.isFinite(options.quality) || options.quality < 0 || options.quality > 100)) {
|
|
16
16
|
throw new RangeError(`quality must be a number between 0 and 100, got ${options.quality}`);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
validateDisplayId(options.displayId);
|
|
19
|
+
return runCatchingAsync(async () => {
|
|
20
|
+
const device = await this._findDevice(udid);
|
|
21
|
+
const displayId = await resolveDisplayPortId(device, options.displayId);
|
|
22
|
+
return await device.screenshot({ ...options, displayId });
|
|
23
|
+
});
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* Lists the device's renderable displays — the same information `simctl io <udid> enumerate`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../../src/commands/screenshot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../../src/commands/screenshot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAS5F;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAEjC,IAAY,EACZ,UAA6B,EAAE;IAE/B,IACE,OAAO,CAAC,OAAO,KAAK,SAAS;QAC7B,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,EACnF,CAAC;QACD,MAAM,IAAI,UAAU,CAAC,mDAAmD,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IACD,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrC,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACxE,OAAO,MAAM,MAAM,CAAC,UAAU,CAAC,EAAC,GAAG,OAAO,EAAE,SAAS,EAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAqB,IAAY;IAChE,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -22,6 +22,8 @@ declare module '../native-simctl.js' {
|
|
|
22
22
|
* mid-recording) doesn't reject it — it's logged here instead — call {@link stopVideoRecording} to
|
|
23
23
|
* observe it as a rejection and release the recording's resources.
|
|
24
24
|
*
|
|
25
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
26
|
+
*
|
|
25
27
|
* @param udid — UDID of the device to record; must be booted
|
|
26
28
|
* @param outputFile — filesystem path to write the video to; resolved against `process.cwd()` if
|
|
27
29
|
* relative, since the native layer requires an absolute path
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-recording.d.ts","sourceRoot":"","sources":["../../../src/commands/video-recording.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAA6B,yBAAyB,EAAE,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAG9G,OAAO,QAAQ,qBAAqB,CAAC;IAC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,EAAE,MAAM,EACZ,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEzF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { logger } from '@appium/support';
|
|
3
|
-
import { runCatchingAsync, toTypedError } from '../utils/index.js';
|
|
3
|
+
import { resolveDisplayPortId, runCatchingAsync, toTypedError, validateDisplayId } from '../utils/index.js';
|
|
4
4
|
const log = logger.getLogger('CoreSim');
|
|
5
5
|
// Tracks which devices currently have an active recording — module-level since the constraint (at
|
|
6
6
|
// most one per device) is CoreSimulator's own, not per-NativeSimctl-instance.
|
|
@@ -20,6 +20,8 @@ const activeRecordings = new Map();
|
|
|
20
20
|
* mid-recording) doesn't reject it — it's logged here instead — call {@link stopVideoRecording} to
|
|
21
21
|
* observe it as a rejection and release the recording's resources.
|
|
22
22
|
*
|
|
23
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
24
|
+
*
|
|
23
25
|
* @param udid — UDID of the device to record; must be booted
|
|
24
26
|
* @param outputFile — filesystem path to write the video to; resolved against `process.cwd()` if
|
|
25
27
|
* relative, since the native layer requires an absolute path
|
|
@@ -36,16 +38,21 @@ export async function startVideoRecording(udid, outputFile, options = {}) {
|
|
|
36
38
|
(!Number.isFinite(options.bitrate) || options.bitrate <= 0 || options.bitrate > 2 ** 31 - 1)) {
|
|
37
39
|
throw new RangeError(`bitrate must be a positive number no greater than ${2 ** 31 - 1}, got ${options.bitrate}`);
|
|
38
40
|
}
|
|
41
|
+
validateDisplayId(options.displayId);
|
|
39
42
|
const key = udid.toLowerCase();
|
|
40
43
|
if (activeRecordings.has(key)) {
|
|
41
44
|
throw new Error(`A video recording is already in progress for device '${udid}'`);
|
|
42
45
|
}
|
|
43
46
|
const absoluteOutputFile = path.resolve(outputFile);
|
|
44
|
-
const startPromise = runCatchingAsync(async () =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const startPromise = runCatchingAsync(async () => {
|
|
48
|
+
const device = await this._findDevice(udid);
|
|
49
|
+
const displayId = await resolveDisplayPortId(device, options.displayId);
|
|
50
|
+
return device.startVideoRecording(absoluteOutputFile, { ...options, displayId }, (err) => {
|
|
51
|
+
// Only ever invoked on the `audio`/`fps` (own-encoder) path — see its own doc comment above.
|
|
52
|
+
// No live consumer to report to (this call already resolved), so logged instead of lost.
|
|
53
|
+
log.error(`Unhandled video recording error for device '${udid}': ${toTypedError(err).stack ?? err}`);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
49
56
|
// Marked before the native call resolves, not after, so a concurrent startVideoRecording for the
|
|
50
57
|
// same device is rejected immediately instead of racing this one — rolled back below on failure.
|
|
51
58
|
const state = { start: startPromise };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-recording.js","sourceRoot":"","sources":["../../../src/commands/video-recording.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAIvC,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"video-recording.js","sourceRoot":"","sources":["../../../src/commands/video-recording.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAIvC,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAU1G,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAexC,kGAAkG;AAClG,8EAA8E;AAC9E,M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AM,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,4FAA4F;QAC5F,MAAM,IAAI,KAAK,CAAC,iDAAiD,IAAI,GAAG,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,gBAAgB,CAAC,KAAK,IAAI,EAAE;QAC9D,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC,CAAC;IACJ,IAAI,CAAC;QACH,MAAM,WAAW,CAAC;IACpB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,6FAA6F;QAC7F,uFAAuF;QACvF,2FAA2F;QAC3F,mBAAmB;QACnB,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;QACzB,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,CAAC,CAAC;QACV,CAAC;QACD,GAAG,CAAC,IAAI,CACN,2DAA2D,IAAI,kCAAkC;YAC/F,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,CAClC,CAAC;IACJ,CAAC;IACD,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;QACxC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAqB,IAAY;IACrE,OAAO,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -85,6 +85,8 @@ export declare class VideoStream extends EventEmitter {
|
|
|
85
85
|
* `startVideoRecording`/`stopVideoRecording` — both, and any number of concurrent streams, can
|
|
86
86
|
* run on the same device at once.
|
|
87
87
|
*
|
|
88
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
89
|
+
*
|
|
88
90
|
* @param udid — UDID of the device to stream; must be booted
|
|
89
91
|
* @param options — `displayId`, `codec`, `fps`, `bitrate`, `audio` — see {@link VideoStreamOptions}
|
|
90
92
|
*/
|
|
@@ -1 +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;AAIzC,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;AASD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAKrC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAe,CAAC,CAAC;IAQ1B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAPvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAClC,OAAO,CAAC,MAAM,CAA6F;IAC3G,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,SAAS,CAAS;gBAGP,IAAI,EAAE;QACrB,yEAAyE;QACzE,iBAAiB,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;QACxC,sFAAsF;QACtF,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;QACjC,yFAAyF;QACzF,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;KACzB;IAGH,IAAI,CAAC,IAAI,EAAE,CAAC,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AAW,CAAC,CAyBtB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { logger } from '@appium/support';
|
|
3
|
-
import { runCatchingAsync, toTypedError } from '../utils/index.js';
|
|
3
|
+
import { resolveDisplayPortId, runCatchingAsync, toTypedError, validateDisplayId } from '../utils/index.js';
|
|
4
4
|
const log = logger.getLogger('CoreSim');
|
|
5
5
|
// Matches the native side's own ThreadSafeFunction queue bound (see coresim.mm's
|
|
6
6
|
// kAccessUnitQueueSize) — kept here too since the native bound alone provides no real
|
|
@@ -220,6 +220,8 @@ export class VideoStream extends EventEmitter {
|
|
|
220
220
|
* `startVideoRecording`/`stopVideoRecording` — both, and any number of concurrent streams, can
|
|
221
221
|
* run on the same device at once.
|
|
222
222
|
*
|
|
223
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
224
|
+
*
|
|
223
225
|
* @param udid — UDID of the device to stream; must be booted
|
|
224
226
|
* @param options — `displayId`, `codec`, `fps`, `bitrate`, `audio` — see {@link VideoStreamOptions}
|
|
225
227
|
*/
|
|
@@ -233,9 +235,11 @@ export async function startVideoStream(udid, options = {}) {
|
|
|
233
235
|
(!Number.isFinite(options.bitrate) || options.bitrate <= 0 || options.bitrate > 2 ** 31 - 1)) {
|
|
234
236
|
throw new RangeError(`bitrate must be a positive number no greater than ${2 ** 31 - 1}, got ${options.bitrate}`);
|
|
235
237
|
}
|
|
238
|
+
validateDisplayId(options.displayId);
|
|
236
239
|
const device = await runCatchingAsync(() => this._findDevice(udid));
|
|
240
|
+
const displayId = await runCatchingAsync(() => resolveDisplayPortId(device, options.displayId));
|
|
237
241
|
const stream = new VideoStream(options.codec === 'hevc' ? 'hevc' : 'h264');
|
|
238
|
-
const handle = await runCatchingAsync(() => device.startVideoStream(options, (unit) => stream._handleAccessUnit(unit), (err) => stream._handleError(err)));
|
|
242
|
+
const handle = await runCatchingAsync(() => device.startVideoStream({ ...options, displayId }, (unit) => stream._handleAccessUnit(unit), (err) => stream._handleError(err)));
|
|
239
243
|
stream._attachHandle(handle);
|
|
240
244
|
return stream;
|
|
241
245
|
}
|
|
@@ -1 +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;AAIvC,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;
|
|
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;AAIvC,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAQ1G,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAExC,iFAAiF;AACjF,sFAAsF;AACtF,mGAAmG;AACnG,gGAAgG;AAChG,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,qBAAqB,GACzB,2GAA2G,CAAC;AAE9G;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,eAAe;IAQP;IAPF,MAAM,GAAQ,EAAE,CAAC;IAC1B,MAAM,CAA6F;IACnG,KAAK,GAAG,KAAK,CAAC;IACd,KAAK,CAAU;IACf,SAAS,GAAG,KAAK,CAAC;IAE1B,YACmB,IAOhB;QAPgB,SAAI,GAAJ,IAAI,CAOpB;IACA,CAAC;IAEJ,IAAI,CAAC,IAAO;QACV,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QACD,IAAI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,IAAI,UAAU,CAAC,qDAAqD,CAAC,IAAI,EAAE,GAAG,CAAC,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACnH,CAAC;IACD,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,CACzC,MAAM,CAAC,gBAAgB,CACrB,EAAC,GAAG,OAAO,EAAE,SAAS,EAAC,EACvB,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"}
|
package/lib/src/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export { VideoStream } from './commands/video-stream.js';
|
|
|
5
5
|
export { JpegStream } from './commands/jpeg-stream.js';
|
|
6
6
|
export type { AppContainerType } from './commands/app.js';
|
|
7
7
|
export type { BiometricName } from './commands/biometric.js';
|
|
8
|
-
export { DeviceOrientation, SimBootStatus, SimDeviceState, type ApnsAlert, type ApnsPayload, type ApnsSound, type JpegFrame, type JpegStreamOptions, type PushNotificationPayload, type ScreenshotOptions, type SimBootInfo, type SimDeviceInfo, type SimDeviceTypeInfo, type SimDisplayInfo, type SimPermissionService, type SimPermissionStatus, type SimProcessInfo, type SimRuntimeInfo, type SpawnOptions, type StopVideoRecordingOptions, type VideoAccessUnit, type VideoRecordingOptions, type VideoStreamOptions, } from './types.js';
|
|
8
|
+
export { DeviceOrientation, SimBootStatus, SimDeviceState, type ApnsAlert, type ApnsPayload, type ApnsSound, type JpegFrame, type JpegStreamOptions, type PushNotificationPayload, type DisplayId, type DisplayOptions, type ScreenshotOptions, type SimBootInfo, type SimDeviceInfo, type SimDeviceTypeInfo, type SimDisplayInfo, type SimPermissionService, type SimPermissionStatus, type SimProcessInfo, type SimRuntimeInfo, type SpawnOptions, type StopVideoRecordingOptions, type VideoAccessUnit, type VideoRecordingOptions, type VideoStreamOptions, } from './types.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/src/index.d.ts.map
CHANGED
|
@@ -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,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;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACrD,YAAY,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB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,CAAC"}
|
package/lib/src/index.js.map
CHANGED
|
@@ -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;AACnD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAGrD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,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;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAGrD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,GAuBf,MAAM,YAAY,CAAC"}
|
package/lib/src/types.d.ts
CHANGED
|
@@ -88,22 +88,29 @@ export type SimPermissionService = 'calendar' | 'camera' | 'contacts' | 'faceid'
|
|
|
88
88
|
* A device's renderable display, as returned by `NativeSimctl.getDisplays()`.
|
|
89
89
|
*/
|
|
90
90
|
export interface SimDisplayInfo {
|
|
91
|
-
/** Port UUID identifying this display — pass as
|
|
91
|
+
/** Port UUID identifying this display — pass as a capture API’s `displayId` option to target it. */
|
|
92
92
|
id: string;
|
|
93
|
-
/**
|
|
93
|
+
/** Guest screen ID (`SimScreenProperties.screenID`), when available. Matches XCTest displayID. */
|
|
94
|
+
screenId?: number;
|
|
95
|
+
/** Raw `SimDisplayDescriptorState.displayClass` — 0 includes both built-in displays on Duo. */
|
|
94
96
|
displayClass: number;
|
|
95
|
-
/** Whether
|
|
97
|
+
/** Whether `displayClass === 0`. Multiple integrated displays may have this value. */
|
|
96
98
|
isMain: boolean;
|
|
97
99
|
}
|
|
100
|
+
/** Port UUID string or unsigned 32-bit guest screen ID (XCTest/WDA displayID). */
|
|
101
|
+
export type DisplayId = string | number;
|
|
102
|
+
/** Display selection shared by screenshot, recording, and streaming APIs. */
|
|
103
|
+
export interface DisplayOptions {
|
|
104
|
+
/**
|
|
105
|
+
* Port UUID from `getDisplays()`, or an unsigned 32-bit guest screen ID (XCTest/WDA displayID).
|
|
106
|
+
* See [display selection helpers](./utils/display.ts) for validation and resolution semantics.
|
|
107
|
+
*/
|
|
108
|
+
displayId?: DisplayId;
|
|
109
|
+
}
|
|
98
110
|
/** Options for `NativeSimctl.getScreenshot`. */
|
|
99
|
-
export interface ScreenshotOptions {
|
|
111
|
+
export interface ScreenshotOptions extends DisplayOptions {
|
|
100
112
|
/** Image encoding — defaults to `'png'`. */
|
|
101
113
|
format?: 'png' | 'jpeg';
|
|
102
|
-
/**
|
|
103
|
-
* Which display to capture, by `id` from `getDisplays()`. Defaults to the primary display
|
|
104
|
-
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
105
|
-
*/
|
|
106
|
-
displayId?: string;
|
|
107
114
|
/**
|
|
108
115
|
* JPEG quality as a percentage (0 = smallest/most compressed, 100 = largest/least compressed).
|
|
109
116
|
* Only meaningful with `format: 'jpeg'` — ignored for `'png'`, which is always lossless.
|
|
@@ -112,12 +119,7 @@ export interface ScreenshotOptions {
|
|
|
112
119
|
quality?: number;
|
|
113
120
|
}
|
|
114
121
|
/** Options for `NativeSimctl.startVideoRecording`. */
|
|
115
|
-
export interface VideoRecordingOptions {
|
|
116
|
-
/**
|
|
117
|
-
* Which display to record, by `id` from `getDisplays()`. Defaults to the primary display
|
|
118
|
-
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
119
|
-
*/
|
|
120
|
-
displayId?: string;
|
|
122
|
+
export interface VideoRecordingOptions extends DisplayOptions {
|
|
121
123
|
/** Video codec — `'h264'` (default) or `'hevc'`. */
|
|
122
124
|
codec?: 'h264' | 'hevc';
|
|
123
125
|
/**
|
|
@@ -162,12 +164,7 @@ export interface StopVideoRecordingOptions {
|
|
|
162
164
|
force?: boolean;
|
|
163
165
|
}
|
|
164
166
|
/** Options for `NativeSimctl.startVideoStream`. */
|
|
165
|
-
export interface VideoStreamOptions {
|
|
166
|
-
/**
|
|
167
|
-
* Which display to stream, by `id` from `getDisplays()`. Defaults to the primary display
|
|
168
|
-
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
169
|
-
*/
|
|
170
|
-
displayId?: string;
|
|
167
|
+
export interface VideoStreamOptions extends DisplayOptions {
|
|
171
168
|
/** Video codec — `'h264'` (default) or `'hevc'`. */
|
|
172
169
|
codec?: 'h264' | 'hevc';
|
|
173
170
|
/**
|
|
@@ -185,12 +182,7 @@ export interface VideoStreamOptions {
|
|
|
185
182
|
audio?: boolean;
|
|
186
183
|
}
|
|
187
184
|
/** Options for `NativeSimctl.startJpegStream`. */
|
|
188
|
-
export interface JpegStreamOptions {
|
|
189
|
-
/**
|
|
190
|
-
* Which display to stream, by `id` from `getDisplays()`. Defaults to the primary display
|
|
191
|
-
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
192
|
-
*/
|
|
193
|
-
displayId?: string;
|
|
185
|
+
export interface JpegStreamOptions extends DisplayOptions {
|
|
194
186
|
/**
|
|
195
187
|
* Max frames/sec to poll the framebuffer at — an unchanged frame is never re-encoded, so this
|
|
196
188
|
* is an upper bound, not a guarantee. Must be >= 1. Defaults to 60.
|
package/lib/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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AAO,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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DisplayId, NativeDeviceHandle } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates a capture API's display selection without querying the device.
|
|
4
|
+
* Strings pass through without UUID syntax or port-existence checks.
|
|
5
|
+
*
|
|
6
|
+
* @param displayId — port UUID string, unsigned 32-bit guest screen ID, or `undefined` for default selection
|
|
7
|
+
* @throws {TypeError} if the value is neither a string, a number, nor `undefined`
|
|
8
|
+
* @throws {RangeError} if a numeric value is not an unsigned 32-bit integer
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateDisplayId(displayId: unknown): void;
|
|
11
|
+
/**
|
|
12
|
+
* Resolves a validated display selection to the port UUID expected by native capture APIs.
|
|
13
|
+
* UUID strings pass through without enumeration; numeric IDs are matched against a fresh list
|
|
14
|
+
* of guest screen IDs (XCTest/WDA displayID) on each call. An omitted ID selects the unique `isMain` (class-0) port.
|
|
15
|
+
* If no class-0 port exists, native capture falls back to the first renderable display.
|
|
16
|
+
* Call once at recording/stream startup, or on each screenshot capture.
|
|
17
|
+
*
|
|
18
|
+
* @param device — native handle for the device whose display ports are queried
|
|
19
|
+
* @param displayId — selection already checked by {@link validateDisplayId}
|
|
20
|
+
* @returns the selected port UUID, or `undefined` to retain native fallback when no default port exists
|
|
21
|
+
* @throws {Error} if a numeric ID has no unique match with a nonempty UUID, or multiple default ports exist
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveDisplayPortId(device: NativeDeviceHandle, displayId: DisplayId | undefined): Promise<string | undefined>;
|
|
24
|
+
//# sourceMappingURL=display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../src/utils/display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,kBAAkB,EAAiB,MAAM,aAAa,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAO1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,SAAS,GAAG,SAAS,GAC/B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAwB7B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates a capture API's display selection without querying the device.
|
|
3
|
+
* Strings pass through without UUID syntax or port-existence checks.
|
|
4
|
+
*
|
|
5
|
+
* @param displayId — port UUID string, unsigned 32-bit guest screen ID, or `undefined` for default selection
|
|
6
|
+
* @throws {TypeError} if the value is neither a string, a number, nor `undefined`
|
|
7
|
+
* @throws {RangeError} if a numeric value is not an unsigned 32-bit integer
|
|
8
|
+
*/
|
|
9
|
+
export function validateDisplayId(displayId) {
|
|
10
|
+
if (displayId !== undefined && typeof displayId !== 'string' && typeof displayId !== 'number') {
|
|
11
|
+
throw new TypeError('displayId must be a port UUID string or a numeric guest screen ID');
|
|
12
|
+
}
|
|
13
|
+
if (typeof displayId === 'number' && (!Number.isInteger(displayId) || displayId < 0 || displayId > 0xffffffff)) {
|
|
14
|
+
throw new RangeError('A numeric displayId must be an unsigned 32-bit integer');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolves a validated display selection to the port UUID expected by native capture APIs.
|
|
19
|
+
* UUID strings pass through without enumeration; numeric IDs are matched against a fresh list
|
|
20
|
+
* of guest screen IDs (XCTest/WDA displayID) on each call. An omitted ID selects the unique `isMain` (class-0) port.
|
|
21
|
+
* If no class-0 port exists, native capture falls back to the first renderable display.
|
|
22
|
+
* Call once at recording/stream startup, or on each screenshot capture.
|
|
23
|
+
*
|
|
24
|
+
* @param device — native handle for the device whose display ports are queried
|
|
25
|
+
* @param displayId — selection already checked by {@link validateDisplayId}
|
|
26
|
+
* @returns the selected port UUID, or `undefined` to retain native fallback when no default port exists
|
|
27
|
+
* @throws {Error} if a numeric ID has no unique match with a nonempty UUID, or multiple default ports exist
|
|
28
|
+
*/
|
|
29
|
+
export async function resolveDisplayPortId(device, displayId) {
|
|
30
|
+
if (typeof displayId === 'string') {
|
|
31
|
+
return displayId;
|
|
32
|
+
}
|
|
33
|
+
const displays = await device.getDisplays();
|
|
34
|
+
if (typeof displayId === 'number') {
|
|
35
|
+
const matches = displays.filter(({ screenId }) => screenId === displayId);
|
|
36
|
+
if (matches.length !== 1 || !matches[0].id) {
|
|
37
|
+
throw new Error(`Cannot uniquely resolve guest screen ID ${displayId} to a display port. ${availableDisplayIdsHint(displays)}`);
|
|
38
|
+
}
|
|
39
|
+
return matches[0].id;
|
|
40
|
+
}
|
|
41
|
+
// Both integrated Duo displays have class 0. Never pick one by port order.
|
|
42
|
+
const defaults = displays.filter(({ isMain }) => isMain);
|
|
43
|
+
if (defaults.length > 1) {
|
|
44
|
+
throw new Error(`Multiple default display ports are available; specify displayId. ${availableDisplayIdsHint(displays)}`);
|
|
45
|
+
}
|
|
46
|
+
return defaults[0]?.id;
|
|
47
|
+
}
|
|
48
|
+
/** Formats the already-fetched screen ID/port UUID pairs for display-selection errors. */
|
|
49
|
+
function availableDisplayIdsHint(displays) {
|
|
50
|
+
if (displays.length === 0) {
|
|
51
|
+
return 'Available display IDs: none';
|
|
52
|
+
}
|
|
53
|
+
return `Available display IDs: ${JSON.stringify(displays.map(({ id, screenId }) => ({ screenId, id })))}`;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IACvD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,oEAAoE,uBAAuB,CAAC,QAAQ,CAAC,EAAE,CACxG,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACzB,CAAC;AAED,0FAA0F;AAC1F,SAAS,uBAAuB,CAAC,QAA0B;IACzD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,6BAA6B,CAAC;IACvC,CAAC;IACD,OAAO,0BAA0B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAC,EAAE,EAAE,QAAQ,EAAC,EAAE,EAAE,CAAC,CAAC,EAAC,QAAQ,EAAE,EAAE,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACxG,CAAC"}
|
package/lib/src/utils/index.d.ts
CHANGED
|
@@ -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,EAAE,YAAY,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;AACjE,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,cAAc,CAAC"}
|
package/lib/src/utils/index.js
CHANGED
|
@@ -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,EAAE,YAAY,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;AACjE,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/coresim",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Native bindings to CoreSimulator.framework for Apple platform simulator control",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/appium/appium-ios/issues"
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"npm": ">=10"
|
|
63
63
|
},
|
|
64
64
|
"gypfile": true,
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "9093de3b79fba810459e0cb42c1aee3e9d30fbe5"
|
|
66
66
|
}
|
|
Binary file
|
|
@@ -4,7 +4,7 @@ import {logger} from '@appium/support';
|
|
|
4
4
|
|
|
5
5
|
import type {NativeSimctl} from '../native-simctl.js';
|
|
6
6
|
import type {JpegFrame, JpegStreamOptions, NativeJpegStreamHandle} from '../types.js';
|
|
7
|
-
import {runCatchingAsync, toTypedError} from '../utils/index.js';
|
|
7
|
+
import {resolveDisplayPortId, runCatchingAsync, toTypedError, validateDisplayId} from '../utils/index.js';
|
|
8
8
|
|
|
9
9
|
declare module '../native-simctl.js' {
|
|
10
10
|
interface NativeSimctl {
|
|
@@ -197,6 +197,8 @@ export class JpegStream extends EventEmitter {
|
|
|
197
197
|
* each frame as it arrives. Independent of `startVideoStream`/`startVideoRecording` — any number of
|
|
198
198
|
* concurrent streams/recordings can run on the same device at once.
|
|
199
199
|
*
|
|
200
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
201
|
+
*
|
|
200
202
|
* @param udid — UDID of the device to stream; must be booted
|
|
201
203
|
* @param options — `displayId`, `fps`, `quality`, `scale` — see {@link JpegStreamOptions}
|
|
202
204
|
*/
|
|
@@ -219,11 +221,13 @@ export async function startJpegStream(
|
|
|
219
221
|
if (options.scale !== undefined && (!Number.isFinite(options.scale) || options.scale <= 0 || options.scale > 100)) {
|
|
220
222
|
throw new RangeError(`scale must be a number greater than 0 and no greater than 100, got ${options.scale}`);
|
|
221
223
|
}
|
|
224
|
+
validateDisplayId(options.displayId);
|
|
222
225
|
const device = await runCatchingAsync(() => this._findDevice(udid));
|
|
226
|
+
const displayId = await runCatchingAsync(() => resolveDisplayPortId(device, options.displayId));
|
|
223
227
|
const stream = new JpegStream();
|
|
224
228
|
const handle = await runCatchingAsync(() =>
|
|
225
229
|
device.startJpegStream(
|
|
226
|
-
options,
|
|
230
|
+
{...options, displayId},
|
|
227
231
|
(frame) => stream._handleFrame(frame),
|
|
228
232
|
(err) => stream._handleError(err),
|
|
229
233
|
),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {NativeSimctl} from '../native-simctl.js';
|
|
2
2
|
import type {ScreenshotOptions, SimDisplayInfo} from '../types.js';
|
|
3
|
-
import {runCatchingAsync} from '../utils/index.js';
|
|
3
|
+
import {resolveDisplayPortId, runCatchingAsync, validateDisplayId} from '../utils/index.js';
|
|
4
4
|
|
|
5
5
|
declare module '../native-simctl.js' {
|
|
6
6
|
interface NativeSimctl {
|
|
@@ -12,11 +12,11 @@ declare module '../native-simctl.js' {
|
|
|
12
12
|
/**
|
|
13
13
|
* Captures a device display as an image — the native equivalent of `simctl io <udid> screenshot`
|
|
14
14
|
* (see native/sim_screenshot.mm for how this reads the framebuffer directly, with no temp file or
|
|
15
|
-
* subprocess). Rejects if the resolved display has no renderable surface yet (e.g. not booted)
|
|
16
|
-
*
|
|
15
|
+
* subprocess). Rejects if the resolved display has no renderable surface yet (e.g. not booted).
|
|
16
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
17
17
|
*
|
|
18
18
|
* @param udid — UDID of the device to capture; must be booted
|
|
19
|
-
* @param options — `format` (defaults to `'png'`), `displayId
|
|
19
|
+
* @param options — `format` (defaults to `'png'`), `displayId`,
|
|
20
20
|
* and `quality` (JPEG only, 0-100 percent)
|
|
21
21
|
* @returns image data encoded as `options.format`
|
|
22
22
|
*/
|
|
@@ -31,7 +31,12 @@ export async function getScreenshot(
|
|
|
31
31
|
) {
|
|
32
32
|
throw new RangeError(`quality must be a number between 0 and 100, got ${options.quality}`);
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
validateDisplayId(options.displayId);
|
|
35
|
+
return runCatchingAsync(async () => {
|
|
36
|
+
const device = await this._findDevice(udid);
|
|
37
|
+
const displayId = await resolveDisplayPortId(device, options.displayId);
|
|
38
|
+
return await device.screenshot({...options, displayId});
|
|
39
|
+
});
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
/**
|
|
@@ -4,7 +4,7 @@ import {logger} from '@appium/support';
|
|
|
4
4
|
|
|
5
5
|
import type {NativeSimctl} from '../native-simctl.js';
|
|
6
6
|
import type {NativeVideoRecordingHandle, StopVideoRecordingOptions, VideoRecordingOptions} from '../types.js';
|
|
7
|
-
import {runCatchingAsync, toTypedError} from '../utils/index.js';
|
|
7
|
+
import {resolveDisplayPortId, runCatchingAsync, toTypedError, validateDisplayId} from '../utils/index.js';
|
|
8
8
|
|
|
9
9
|
declare module '../native-simctl.js' {
|
|
10
10
|
interface NativeSimctl {
|
|
@@ -48,6 +48,8 @@ const activeRecordings = new Map<string, RecordingState>();
|
|
|
48
48
|
* mid-recording) doesn't reject it — it's logged here instead — call {@link stopVideoRecording} to
|
|
49
49
|
* observe it as a rejection and release the recording's resources.
|
|
50
50
|
*
|
|
51
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
52
|
+
*
|
|
51
53
|
* @param udid — UDID of the device to record; must be booted
|
|
52
54
|
* @param outputFile — filesystem path to write the video to; resolved against `process.cwd()` if
|
|
53
55
|
* relative, since the native layer requires an absolute path
|
|
@@ -71,18 +73,21 @@ export async function startVideoRecording(
|
|
|
71
73
|
) {
|
|
72
74
|
throw new RangeError(`bitrate must be a positive number no greater than ${2 ** 31 - 1}, got ${options.bitrate}`);
|
|
73
75
|
}
|
|
76
|
+
validateDisplayId(options.displayId);
|
|
74
77
|
const key = udid.toLowerCase();
|
|
75
78
|
if (activeRecordings.has(key)) {
|
|
76
79
|
throw new Error(`A video recording is already in progress for device '${udid}'`);
|
|
77
80
|
}
|
|
78
81
|
const absoluteOutputFile = path.resolve(outputFile);
|
|
79
|
-
const startPromise = runCatchingAsync(async () =>
|
|
80
|
-
|
|
82
|
+
const startPromise = runCatchingAsync(async () => {
|
|
83
|
+
const device = await this._findDevice(udid);
|
|
84
|
+
const displayId = await resolveDisplayPortId(device, options.displayId);
|
|
85
|
+
return device.startVideoRecording(absoluteOutputFile, {...options, displayId}, (err) => {
|
|
81
86
|
// Only ever invoked on the `audio`/`fps` (own-encoder) path — see its own doc comment above.
|
|
82
87
|
// No live consumer to report to (this call already resolved), so logged instead of lost.
|
|
83
88
|
log.error(`Unhandled video recording error for device '${udid}': ${toTypedError(err).stack ?? err}`);
|
|
84
|
-
})
|
|
85
|
-
);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
86
91
|
// Marked before the native call resolves, not after, so a concurrent startVideoRecording for the
|
|
87
92
|
// same device is rejected immediately instead of racing this one — rolled back below on failure.
|
|
88
93
|
const state: RecordingState = {start: startPromise};
|
|
@@ -4,7 +4,7 @@ import {logger} from '@appium/support';
|
|
|
4
4
|
|
|
5
5
|
import type {NativeSimctl} from '../native-simctl.js';
|
|
6
6
|
import type {NativeVideoStreamHandle, VideoAccessUnit, VideoStreamOptions} from '../types.js';
|
|
7
|
-
import {runCatchingAsync, toTypedError} from '../utils/index.js';
|
|
7
|
+
import {resolveDisplayPortId, runCatchingAsync, toTypedError, validateDisplayId} from '../utils/index.js';
|
|
8
8
|
|
|
9
9
|
declare module '../native-simctl.js' {
|
|
10
10
|
interface NativeSimctl {
|
|
@@ -250,6 +250,8 @@ export class VideoStream extends EventEmitter {
|
|
|
250
250
|
* `startVideoRecording`/`stopVideoRecording` — both, and any number of concurrent streams, can
|
|
251
251
|
* run on the same device at once.
|
|
252
252
|
*
|
|
253
|
+
* Display selection follows {@link validateDisplayId} and {@link resolveDisplayPortId}.
|
|
254
|
+
*
|
|
253
255
|
* @param udid — UDID of the device to stream; must be booted
|
|
254
256
|
* @param options — `displayId`, `codec`, `fps`, `bitrate`, `audio` — see {@link VideoStreamOptions}
|
|
255
257
|
*/
|
|
@@ -269,11 +271,13 @@ export async function startVideoStream(
|
|
|
269
271
|
) {
|
|
270
272
|
throw new RangeError(`bitrate must be a positive number no greater than ${2 ** 31 - 1}, got ${options.bitrate}`);
|
|
271
273
|
}
|
|
274
|
+
validateDisplayId(options.displayId);
|
|
272
275
|
const device = await runCatchingAsync(() => this._findDevice(udid));
|
|
276
|
+
const displayId = await runCatchingAsync(() => resolveDisplayPortId(device, options.displayId));
|
|
273
277
|
const stream = new VideoStream(options.codec === 'hevc' ? 'hevc' : 'h264');
|
|
274
278
|
const handle = await runCatchingAsync(() =>
|
|
275
279
|
device.startVideoStream(
|
|
276
|
-
options,
|
|
280
|
+
{...options, displayId},
|
|
277
281
|
(unit) => stream._handleAccessUnit(unit),
|
|
278
282
|
(err) => stream._handleError(err),
|
|
279
283
|
),
|
package/src/index.ts
CHANGED
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
namespace coresim {
|
|
7
7
|
|
|
8
8
|
// Enumerates the device's renderable display IO ports — the same information `simctl io <udid>
|
|
9
|
-
// enumerate` reports for its own `--display` selection. Each element
|
|
10
|
-
// UUID — pass to CaptureScreenshot's displayId to target it
|
|
11
|
-
// unsigned short
|
|
12
|
-
//
|
|
13
|
-
//
|
|
9
|
+
// enumerate` reports for its own `--display` selection. Each element contains:
|
|
10
|
+
// - "id": NSString port UUID — pass to CaptureScreenshot's displayId to target it.
|
|
11
|
+
// - "displayClass": NSNumber/unsigned short, the raw display class.
|
|
12
|
+
// - "isMain": NSNumber/BOOL, true when displayClass == 0. Multiple integrated displays can
|
|
13
|
+
// have class 0 (e.g. both Duo displays); this does not identify a unique primary display.
|
|
14
|
+
// - "screenId": optional NSNumber/unsigned int guest screen ID from SimScreenProperties.screenID,
|
|
15
|
+
// matching XCTest's displayID. Omitted when the required selectors are unavailable.
|
|
16
|
+
// Returns nil (and sets *error) if the device has no IO client at all (e.g. not booted); an empty
|
|
17
|
+
// (non-nil) array means the device has an IO client but no renderable display.
|
|
14
18
|
NSArray<NSDictionary*>* ListDisplays(id device, NSError** error);
|
|
15
19
|
|
|
16
20
|
// Resolves the display descriptor CaptureScreenshot itself reads from, without capturing a
|
|
@@ -40,8 +44,9 @@ NSData* EncodeImage(CGImageRef cgImage, ScreenshotFormat format, NSNumber* jpegQ
|
|
|
40
44
|
// Captures a display as an image, reading the same in-process framebuffer surface `simctl io
|
|
41
45
|
// <udid> screenshot` itself reads (see sim_screenshot.mm) — no temp file, no subprocess.
|
|
42
46
|
// `displayId`, if non-nil, selects a specific port by its UUID (see ListDisplays); nil selects the
|
|
43
|
-
//
|
|
44
|
-
// tvOS
|
|
47
|
+
// first class-0 display, falling back to the first renderable display if none has class 0 (e.g.
|
|
48
|
+
// tvOS). Native selection does not reject multiple class-0 ports; callers that require a unique
|
|
49
|
+
// target must resolve a UUID first. `jpegQualityPercent` (0-100, nil for ImageIO's own default)
|
|
45
50
|
// only applies when `format` is kJPEG — ignored for kPNG, which is always lossless. Returns nil
|
|
46
51
|
// (and sets *error) if `displayId` doesn't match any port, the resolved display has no renderable
|
|
47
52
|
// surface yet (e.g. not booted), or rendering/encoding failed.
|
|
@@ -183,11 +183,27 @@ NSArray<NSDictionary*>* ListDisplays(id device, NSError** error) {
|
|
|
183
183
|
NSMutableArray<NSDictionary*>* result = [NSMutableArray arrayWithCapacity:candidates.count];
|
|
184
184
|
for (NSDictionary* candidate in candidates) {
|
|
185
185
|
unsigned short displayClass = [candidate[kCandidateDisplayClassKey] unsignedShortValue];
|
|
186
|
-
[
|
|
186
|
+
NSMutableDictionary* display = [@{
|
|
187
187
|
@"id" : candidate[kCandidateUUIDKey],
|
|
188
188
|
@"displayClass" : candidate[kCandidateDisplayClassKey],
|
|
189
189
|
@"isMain" : @(displayClass == 0),
|
|
190
|
-
}];
|
|
190
|
+
} mutableCopy];
|
|
191
|
+
// A Duo has multiple class-0 displays. Use the guest screen ID to associate
|
|
192
|
+
// a port UUID with XCTest's displayID; class or enumeration order is ambiguous.
|
|
193
|
+
id descriptor = candidate[kCandidateDescriptorKey];
|
|
194
|
+
SEL propertiesSelector = SelectorNamed("screenProperties");
|
|
195
|
+
if ([descriptor respondsToSelector:propertiesSelector]) {
|
|
196
|
+
id properties = IdGetter(descriptor, "screenProperties");
|
|
197
|
+
SEL screenIDSelector = SelectorNamed("screenID");
|
|
198
|
+
if ([properties respondsToSelector:screenIDSelector]) {
|
|
199
|
+
unsigned int screenID = SafeInvoke([&] {
|
|
200
|
+
using Fn = unsigned int (*)(id, SEL);
|
|
201
|
+
return ((Fn)objc_msgSend)(properties, screenIDSelector);
|
|
202
|
+
});
|
|
203
|
+
display[@"screenId"] = @(screenID);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
[result addObject:display];
|
|
191
207
|
}
|
|
192
208
|
return result;
|
|
193
209
|
}
|
|
@@ -238,10 +254,10 @@ NSData* CaptureScreenshot(id device, NSString* displayId, ScreenshotFormat forma
|
|
|
238
254
|
return nil;
|
|
239
255
|
}
|
|
240
256
|
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
CIContext* context = [CIContext contextWithOptions:nil];
|
|
257
|
+
// One CIContext shared by every call: creating a context costs more than rendering a frame
|
|
258
|
+
// through it, and CIContext is safe to use from multiple threads. The rendered pixels are
|
|
259
|
+
// the same as with a fresh context.
|
|
260
|
+
static CIContext* context = [CIContext contextWithOptions:nil];
|
|
245
261
|
CGImageRef cgImage = [context createCGImage:ciImage fromRect:ciImage.extent];
|
|
246
262
|
if (cgImage == nil) {
|
|
247
263
|
*error = MakeError(6, @"Failed to render the device's display surface");
|
package/src/types.ts
CHANGED
|
@@ -111,23 +111,32 @@ export type SimPermissionService =
|
|
|
111
111
|
* A device's renderable display, as returned by `NativeSimctl.getDisplays()`.
|
|
112
112
|
*/
|
|
113
113
|
export interface SimDisplayInfo {
|
|
114
|
-
/** Port UUID identifying this display — pass as
|
|
114
|
+
/** Port UUID identifying this display — pass as a capture API’s `displayId` option to target it. */
|
|
115
115
|
id: string;
|
|
116
|
-
/**
|
|
116
|
+
/** Guest screen ID (`SimScreenProperties.screenID`), when available. Matches XCTest displayID. */
|
|
117
|
+
screenId?: number;
|
|
118
|
+
/** Raw `SimDisplayDescriptorState.displayClass` — 0 includes both built-in displays on Duo. */
|
|
117
119
|
displayClass: number;
|
|
118
|
-
/** Whether
|
|
120
|
+
/** Whether `displayClass === 0`. Multiple integrated displays may have this value. */
|
|
119
121
|
isMain: boolean;
|
|
120
122
|
}
|
|
121
123
|
|
|
124
|
+
/** Port UUID string or unsigned 32-bit guest screen ID (XCTest/WDA displayID). */
|
|
125
|
+
export type DisplayId = string | number;
|
|
126
|
+
|
|
127
|
+
/** Display selection shared by screenshot, recording, and streaming APIs. */
|
|
128
|
+
export interface DisplayOptions {
|
|
129
|
+
/**
|
|
130
|
+
* Port UUID from `getDisplays()`, or an unsigned 32-bit guest screen ID (XCTest/WDA displayID).
|
|
131
|
+
* See [display selection helpers](./utils/display.ts) for validation and resolution semantics.
|
|
132
|
+
*/
|
|
133
|
+
displayId?: DisplayId;
|
|
134
|
+
}
|
|
135
|
+
|
|
122
136
|
/** Options for `NativeSimctl.getScreenshot`. */
|
|
123
|
-
export interface ScreenshotOptions {
|
|
137
|
+
export interface ScreenshotOptions extends DisplayOptions {
|
|
124
138
|
/** Image encoding — defaults to `'png'`. */
|
|
125
139
|
format?: 'png' | 'jpeg';
|
|
126
|
-
/**
|
|
127
|
-
* Which display to capture, by `id` from `getDisplays()`. Defaults to the primary display
|
|
128
|
-
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
129
|
-
*/
|
|
130
|
-
displayId?: string;
|
|
131
140
|
/**
|
|
132
141
|
* JPEG quality as a percentage (0 = smallest/most compressed, 100 = largest/least compressed).
|
|
133
142
|
* Only meaningful with `format: 'jpeg'` — ignored for `'png'`, which is always lossless.
|
|
@@ -137,12 +146,7 @@ export interface ScreenshotOptions {
|
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
/** Options for `NativeSimctl.startVideoRecording`. */
|
|
140
|
-
export interface VideoRecordingOptions {
|
|
141
|
-
/**
|
|
142
|
-
* Which display to record, by `id` from `getDisplays()`. Defaults to the primary display
|
|
143
|
-
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
144
|
-
*/
|
|
145
|
-
displayId?: string;
|
|
149
|
+
export interface VideoRecordingOptions extends DisplayOptions {
|
|
146
150
|
/** Video codec — `'h264'` (default) or `'hevc'`. */
|
|
147
151
|
codec?: 'h264' | 'hevc';
|
|
148
152
|
/**
|
|
@@ -189,12 +193,7 @@ export interface StopVideoRecordingOptions {
|
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
/** Options for `NativeSimctl.startVideoStream`. */
|
|
192
|
-
export interface VideoStreamOptions {
|
|
193
|
-
/**
|
|
194
|
-
* Which display to stream, by `id` from `getDisplays()`. Defaults to the primary display
|
|
195
|
-
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
196
|
-
*/
|
|
197
|
-
displayId?: string;
|
|
196
|
+
export interface VideoStreamOptions extends DisplayOptions {
|
|
198
197
|
/** Video codec — `'h264'` (default) or `'hevc'`. */
|
|
199
198
|
codec?: 'h264' | 'hevc';
|
|
200
199
|
/**
|
|
@@ -213,12 +212,7 @@ export interface VideoStreamOptions {
|
|
|
213
212
|
}
|
|
214
213
|
|
|
215
214
|
/** Options for `NativeSimctl.startJpegStream`. */
|
|
216
|
-
export interface JpegStreamOptions {
|
|
217
|
-
/**
|
|
218
|
-
* Which display to stream, by `id` from `getDisplays()`. Defaults to the primary display
|
|
219
|
-
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
220
|
-
*/
|
|
221
|
-
displayId?: string;
|
|
215
|
+
export interface JpegStreamOptions extends DisplayOptions {
|
|
222
216
|
/**
|
|
223
217
|
* Max frames/sec to poll the framebuffer at — an unchanged frame is never re-encoded, so this
|
|
224
218
|
* is an upper bound, not a guarantee. Must be >= 1. Defaults to 60.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type {DisplayId, NativeDeviceHandle, SimDisplayInfo} from '../types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Validates a capture API's display selection without querying the device.
|
|
5
|
+
* Strings pass through without UUID syntax or port-existence checks.
|
|
6
|
+
*
|
|
7
|
+
* @param displayId — port UUID string, unsigned 32-bit guest screen ID, or `undefined` for default selection
|
|
8
|
+
* @throws {TypeError} if the value is neither a string, a number, nor `undefined`
|
|
9
|
+
* @throws {RangeError} if a numeric value is not an unsigned 32-bit integer
|
|
10
|
+
*/
|
|
11
|
+
export function validateDisplayId(displayId: unknown): void {
|
|
12
|
+
if (displayId !== undefined && typeof displayId !== 'string' && typeof displayId !== 'number') {
|
|
13
|
+
throw new TypeError('displayId must be a port UUID string or a numeric guest screen ID');
|
|
14
|
+
}
|
|
15
|
+
if (typeof displayId === 'number' && (!Number.isInteger(displayId) || displayId < 0 || displayId > 0xffffffff)) {
|
|
16
|
+
throw new RangeError('A numeric displayId must be an unsigned 32-bit integer');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Resolves a validated display selection to the port UUID expected by native capture APIs.
|
|
22
|
+
* UUID strings pass through without enumeration; numeric IDs are matched against a fresh list
|
|
23
|
+
* of guest screen IDs (XCTest/WDA displayID) on each call. An omitted ID selects the unique `isMain` (class-0) port.
|
|
24
|
+
* If no class-0 port exists, native capture falls back to the first renderable display.
|
|
25
|
+
* Call once at recording/stream startup, or on each screenshot capture.
|
|
26
|
+
*
|
|
27
|
+
* @param device — native handle for the device whose display ports are queried
|
|
28
|
+
* @param displayId — selection already checked by {@link validateDisplayId}
|
|
29
|
+
* @returns the selected port UUID, or `undefined` to retain native fallback when no default port exists
|
|
30
|
+
* @throws {Error} if a numeric ID has no unique match with a nonempty UUID, or multiple default ports exist
|
|
31
|
+
*/
|
|
32
|
+
export async function resolveDisplayPortId(
|
|
33
|
+
device: NativeDeviceHandle,
|
|
34
|
+
displayId: DisplayId | undefined,
|
|
35
|
+
): Promise<string | undefined> {
|
|
36
|
+
if (typeof displayId === 'string') {
|
|
37
|
+
return displayId;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const displays = await device.getDisplays();
|
|
41
|
+
if (typeof displayId === 'number') {
|
|
42
|
+
const matches = displays.filter(({screenId}) => screenId === displayId);
|
|
43
|
+
if (matches.length !== 1 || !matches[0].id) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Cannot uniquely resolve guest screen ID ${displayId} to a display port. ${availableDisplayIdsHint(displays)}`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return matches[0].id;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Both integrated Duo displays have class 0. Never pick one by port order.
|
|
52
|
+
const defaults = displays.filter(({isMain}) => isMain);
|
|
53
|
+
if (defaults.length > 1) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`Multiple default display ports are available; specify displayId. ${availableDisplayIdsHint(displays)}`,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return defaults[0]?.id;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Formats the already-fetched screen ID/port UUID pairs for display-selection errors. */
|
|
62
|
+
function availableDisplayIdsHint(displays: SimDisplayInfo[]): string {
|
|
63
|
+
if (displays.length === 0) {
|
|
64
|
+
return 'Available display IDs: none';
|
|
65
|
+
}
|
|
66
|
+
return `Available display IDs: ${JSON.stringify(displays.map(({id, screenId}) => ({screenId, id})))}`;
|
|
67
|
+
}
|
package/src/utils/index.ts
CHANGED