@appium/coresim 1.7.0 → 1.9.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 +12 -0
- package/README.md +5 -3
- package/binding.gyp +3 -1
- package/lib/src/commands/jpeg-stream.d.ts +44 -0
- package/lib/src/commands/jpeg-stream.d.ts.map +1 -0
- package/lib/src/commands/jpeg-stream.js +198 -0
- package/lib/src/commands/jpeg-stream.js.map +1 -0
- package/lib/src/commands/ui.d.ts +21 -0
- package/lib/src/commands/ui.d.ts.map +1 -1
- package/lib/src/commands/ui.js +22 -0
- package/lib/src/commands/ui.js.map +1 -1
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/native-simctl.d.ts +2 -0
- package/lib/src/native-simctl.d.ts.map +1 -1
- package/lib/src/native-simctl.js +6 -1
- package/lib/src/native-simctl.js.map +1 -1
- package/lib/src/types.d.ts +64 -2
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +8 -0
- package/lib/src/types.js.map +1 -1
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@appium+coresim.node +0 -0
- package/src/commands/jpeg-stream.ts +233 -0
- package/src/commands/ui.ts +27 -0
- package/src/coresim.mm +199 -6
- package/src/index.ts +4 -0
- package/src/native/audio_encoder.mm +1 -1
- package/src/native/av_recording.h +1 -1
- package/src/native/av_recording.mm +76 -27
- package/src/native/sim_audio_tap.mm +3 -3
- package/src/native/sim_device.h +11 -0
- package/src/native/sim_device.mm +53 -0
- package/src/native/sim_jpeg_stream.h +69 -0
- package/src/native/sim_jpeg_stream.mm +322 -0
- package/src/native/sim_orientation.h +16 -0
- package/src/native/sim_orientation.mm +58 -0
- package/src/native/sim_pasteboard.mm +3 -3
- package/src/native/sim_process.mm +1 -1
- package/src/native/sim_screenshot.h +13 -0
- package/src/native/sim_screenshot.mm +50 -25
- package/src/native/sim_video_recording.mm +2 -43
- package/src/native/tcc_privacy.mm +1 -1
- package/src/native/video_encoder.h +9 -2
- package/src/native/video_encoder.mm +241 -21
- package/src/native-simctl.ts +7 -0
- package/src/types.ts +69 -2
package/src/types.ts
CHANGED
|
@@ -7,6 +7,14 @@ export enum SimDeviceState {
|
|
|
7
7
|
ShuttingDown = 4,
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/** Device orientations `setOrientation` accepts — the raw GSEvent wire values (see CLAUDE.md). */
|
|
11
|
+
export enum DeviceOrientation {
|
|
12
|
+
Portrait = 1,
|
|
13
|
+
PortraitUpsideDown = 2,
|
|
14
|
+
LandscapeRight = 3,
|
|
15
|
+
LandscapeLeft = 4,
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
/** A device in the default device set, as returned by `NativeSimctl.getDevices()`/`createDevice()`. */
|
|
11
19
|
export interface SimDeviceInfo {
|
|
12
20
|
/** e.g. `"D768CB90-CBB4-4557-82F6-B89E1CD0E80B"`. */
|
|
@@ -191,10 +199,10 @@ export interface VideoStreamOptions {
|
|
|
191
199
|
codec?: 'h264' | 'hevc';
|
|
192
200
|
/**
|
|
193
201
|
* Max frames/sec to poll the framebuffer at — an unchanged frame is never re-encoded, so this
|
|
194
|
-
* is an upper bound, not a guarantee. Must be >= 1. Defaults to
|
|
202
|
+
* is an upper bound, not a guarantee. Must be >= 1. Defaults to 60.
|
|
195
203
|
*/
|
|
196
204
|
fps?: number;
|
|
197
|
-
/** Target average bitrate, in bits/sec. Defaults to
|
|
205
|
+
/** Target average bitrate, in bits/sec. Defaults to 4,000,000 (4 Mbps). */
|
|
198
206
|
bitrate?: number;
|
|
199
207
|
/**
|
|
200
208
|
* Also stream the device's audio, interleaved into the same `accessUnits()` sequence. Defaults
|
|
@@ -204,6 +212,44 @@ export interface VideoStreamOptions {
|
|
|
204
212
|
audio?: boolean;
|
|
205
213
|
}
|
|
206
214
|
|
|
215
|
+
/** 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;
|
|
222
|
+
/**
|
|
223
|
+
* Max frames/sec to poll the framebuffer at — an unchanged frame is never re-encoded, so this
|
|
224
|
+
* is an upper bound, not a guarantee. Must be >= 1. Defaults to 60.
|
|
225
|
+
*/
|
|
226
|
+
fps?: number;
|
|
227
|
+
/**
|
|
228
|
+
* JPEG quality as a percentage (0 = smallest/most compressed, 100 = largest/least compressed).
|
|
229
|
+
* Defaults to 80 — noticeably smaller than {@link ScreenshotOptions.quality}'s own (near-
|
|
230
|
+
* lossless) default, more suitable for a continuous live stream than a one-off screenshot.
|
|
231
|
+
*/
|
|
232
|
+
quality?: number;
|
|
233
|
+
/**
|
|
234
|
+
* Frame scale as a percentage of the original display resolution — 100 (default) performs no
|
|
235
|
+
* scaling; must be greater than 0 and no greater than 100.
|
|
236
|
+
*/
|
|
237
|
+
scale?: number;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* One JPEG-encoded frame from `JpegStream.frames()`. Unlike {@link VideoAccessUnit}, every frame
|
|
242
|
+
* is independently decodable — there's no keyframe/interframe distinction — so consumers (e.g. an
|
|
243
|
+
* MJPEG multipart HTTP stream built from this sequence) can start from, or drop, any frame freely.
|
|
244
|
+
*/
|
|
245
|
+
export interface JpegFrame {
|
|
246
|
+
data: Buffer;
|
|
247
|
+
/** Monotonically increasing, starting at 0. */
|
|
248
|
+
sequence: number;
|
|
249
|
+
/** Microseconds since the stream started. */
|
|
250
|
+
timestampMicros: number;
|
|
251
|
+
}
|
|
252
|
+
|
|
207
253
|
/**
|
|
208
254
|
* One encoded unit from `VideoStream.accessUnits()`, discriminated by `track`: a video unit
|
|
209
255
|
* (Annex-B NAL units — a keyframe's `data` has parameter sets, SPS/PPS or VPS/SPS/PPS for HEVC,
|
|
@@ -349,6 +395,20 @@ export interface NativeVideoStreamHandle {
|
|
|
349
395
|
requestKeyFrame(): void;
|
|
350
396
|
}
|
|
351
397
|
|
|
398
|
+
/** Raw shape of a JPEG frame as the native addon delivers it — see {@link JpegFrame}. */
|
|
399
|
+
export interface NativeJpegFrame {
|
|
400
|
+
data: Buffer;
|
|
401
|
+
sequence: number;
|
|
402
|
+
timestampMicros: number;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export type NativeJpegFrameCallback = (frame: NativeJpegFrame) => void;
|
|
406
|
+
|
|
407
|
+
/** A live `coresim::JpegStreamSession`, wrapped by `coresim.mm`'s `NativeJpegStream`. */
|
|
408
|
+
export interface NativeJpegStreamHandle {
|
|
409
|
+
stop(): Promise<void>;
|
|
410
|
+
}
|
|
411
|
+
|
|
352
412
|
/**
|
|
353
413
|
* A live recording, wrapped by `coresim.mm`'s `NativePrivateRecordingHandle` (video only,
|
|
354
414
|
* addressing CoreSimulator's own internally-tracked private recorder) or `NativeAVRecording`
|
|
@@ -384,6 +444,8 @@ export interface NativeDeviceHandle {
|
|
|
384
444
|
openUrl(url: string): Promise<void>;
|
|
385
445
|
setLocation(latitude: number, longitude: number): Promise<void>;
|
|
386
446
|
clearLocation(): Promise<void>;
|
|
447
|
+
setOrientation(orientation: number): Promise<void>;
|
|
448
|
+
getOrientation(): Promise<number>;
|
|
387
449
|
sendPushNotification(bundleId: string, payload: PushNotificationPayload): Promise<void>;
|
|
388
450
|
addCertificate(path: string, trustAsRoot: boolean): Promise<void>;
|
|
389
451
|
resetKeychain(): Promise<void>;
|
|
@@ -431,6 +493,11 @@ export interface NativeDeviceHandle {
|
|
|
431
493
|
onAccessUnit: NativeVideoAccessUnitCallback,
|
|
432
494
|
onError: NativeVideoErrorCallback,
|
|
433
495
|
): Promise<NativeVideoStreamHandle>;
|
|
496
|
+
startJpegStream(
|
|
497
|
+
options: {displayId?: string; fps?: number; quality?: number; scale?: number} | undefined,
|
|
498
|
+
onFrame: NativeJpegFrameCallback,
|
|
499
|
+
onError: NativeVideoErrorCallback,
|
|
500
|
+
): Promise<NativeJpegStreamHandle>;
|
|
434
501
|
spawn(path: string, options: SpawnOptions | undefined, onExit: NativeSpawnExitCallback): Promise<NativeSpawnResult>;
|
|
435
502
|
}
|
|
436
503
|
|