@appium/coresim 1.6.0 → 1.8.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 +2 -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/video-recording.d.ts +12 -3
- package/lib/src/commands/video-recording.d.ts.map +1 -1
- package/lib/src/commands/video-recording.js +19 -5
- package/lib/src/commands/video-recording.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 +1 -0
- 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 +3 -0
- package/lib/src/native-simctl.js.map +1 -1
- package/lib/src/types.d.ts +65 -2
- package/lib/src/types.d.ts.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/video-recording.ts +27 -7
- package/src/coresim.mm +170 -6
- package/src/index.ts +4 -0
- package/src/native/audio_encoder.mm +1 -1
- package/src/native/av_recording.mm +1 -1
- package/src/native/sim_audio_tap.mm +3 -3
- package/src/native/sim_jpeg_stream.h +69 -0
- package/src/native/sim_jpeg_stream.mm +322 -0
- package/src/native/sim_pasteboard.mm +3 -3
- package/src/native/sim_process.mm +1 -1
- package/src/native/sim_screenshot.h +8 -0
- package/src/native/sim_screenshot.mm +29 -25
- package/src/native/sim_video_recording.mm +1 -1
- package/src/native/tcc_privacy.mm +1 -1
- package/src/native/video_encoder.h +2 -2
- package/src/native/video_encoder.mm +2 -2
- package/src/native-simctl.ts +3 -0
- package/src/types.ts +70 -2
package/src/types.ts
CHANGED
|
@@ -169,6 +169,17 @@ export interface VideoRecordingOptions {
|
|
|
169
169
|
bitrate?: number;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
/** Options for `NativeSimctl.stopVideoRecording`. */
|
|
173
|
+
export interface StopVideoRecordingOptions {
|
|
174
|
+
/**
|
|
175
|
+
* Best-effort: still attempts the native stop, but releases this device's tracked-active-
|
|
176
|
+
* recording bookkeeping regardless of whether that attempt succeeds, instead of leaving it
|
|
177
|
+
* retryable — see the doc comment above `NativeSimctl.stopVideoRecording` for when a caller
|
|
178
|
+
* needs this over a plain retry.
|
|
179
|
+
*/
|
|
180
|
+
force?: boolean;
|
|
181
|
+
}
|
|
182
|
+
|
|
172
183
|
/** Options for `NativeSimctl.startVideoStream`. */
|
|
173
184
|
export interface VideoStreamOptions {
|
|
174
185
|
/**
|
|
@@ -180,10 +191,10 @@ export interface VideoStreamOptions {
|
|
|
180
191
|
codec?: 'h264' | 'hevc';
|
|
181
192
|
/**
|
|
182
193
|
* Max frames/sec to poll the framebuffer at — an unchanged frame is never re-encoded, so this
|
|
183
|
-
* is an upper bound, not a guarantee. Must be >= 1. Defaults to
|
|
194
|
+
* is an upper bound, not a guarantee. Must be >= 1. Defaults to 60.
|
|
184
195
|
*/
|
|
185
196
|
fps?: number;
|
|
186
|
-
/** Target average bitrate, in bits/sec. Defaults to
|
|
197
|
+
/** Target average bitrate, in bits/sec. Defaults to 4,000,000 (4 Mbps). */
|
|
187
198
|
bitrate?: number;
|
|
188
199
|
/**
|
|
189
200
|
* Also stream the device's audio, interleaved into the same `accessUnits()` sequence. Defaults
|
|
@@ -193,6 +204,44 @@ export interface VideoStreamOptions {
|
|
|
193
204
|
audio?: boolean;
|
|
194
205
|
}
|
|
195
206
|
|
|
207
|
+
/** Options for `NativeSimctl.startJpegStream`. */
|
|
208
|
+
export interface JpegStreamOptions {
|
|
209
|
+
/**
|
|
210
|
+
* Which display to stream, by `id` from `getDisplays()`. Defaults to the primary display
|
|
211
|
+
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
212
|
+
*/
|
|
213
|
+
displayId?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Max frames/sec to poll the framebuffer at — an unchanged frame is never re-encoded, so this
|
|
216
|
+
* is an upper bound, not a guarantee. Must be >= 1. Defaults to 60.
|
|
217
|
+
*/
|
|
218
|
+
fps?: number;
|
|
219
|
+
/**
|
|
220
|
+
* JPEG quality as a percentage (0 = smallest/most compressed, 100 = largest/least compressed).
|
|
221
|
+
* Defaults to 80 — noticeably smaller than {@link ScreenshotOptions.quality}'s own (near-
|
|
222
|
+
* lossless) default, more suitable for a continuous live stream than a one-off screenshot.
|
|
223
|
+
*/
|
|
224
|
+
quality?: number;
|
|
225
|
+
/**
|
|
226
|
+
* Frame scale as a percentage of the original display resolution — 100 (default) performs no
|
|
227
|
+
* scaling; must be greater than 0 and no greater than 100.
|
|
228
|
+
*/
|
|
229
|
+
scale?: number;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* One JPEG-encoded frame from `JpegStream.frames()`. Unlike {@link VideoAccessUnit}, every frame
|
|
234
|
+
* is independently decodable — there's no keyframe/interframe distinction — so consumers (e.g. an
|
|
235
|
+
* MJPEG multipart HTTP stream built from this sequence) can start from, or drop, any frame freely.
|
|
236
|
+
*/
|
|
237
|
+
export interface JpegFrame {
|
|
238
|
+
data: Buffer;
|
|
239
|
+
/** Monotonically increasing, starting at 0. */
|
|
240
|
+
sequence: number;
|
|
241
|
+
/** Microseconds since the stream started. */
|
|
242
|
+
timestampMicros: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
196
245
|
/**
|
|
197
246
|
* One encoded unit from `VideoStream.accessUnits()`, discriminated by `track`: a video unit
|
|
198
247
|
* (Annex-B NAL units — a keyframe's `data` has parameter sets, SPS/PPS or VPS/SPS/PPS for HEVC,
|
|
@@ -338,6 +387,20 @@ export interface NativeVideoStreamHandle {
|
|
|
338
387
|
requestKeyFrame(): void;
|
|
339
388
|
}
|
|
340
389
|
|
|
390
|
+
/** Raw shape of a JPEG frame as the native addon delivers it — see {@link JpegFrame}. */
|
|
391
|
+
export interface NativeJpegFrame {
|
|
392
|
+
data: Buffer;
|
|
393
|
+
sequence: number;
|
|
394
|
+
timestampMicros: number;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export type NativeJpegFrameCallback = (frame: NativeJpegFrame) => void;
|
|
398
|
+
|
|
399
|
+
/** A live `coresim::JpegStreamSession`, wrapped by `coresim.mm`'s `NativeJpegStream`. */
|
|
400
|
+
export interface NativeJpegStreamHandle {
|
|
401
|
+
stop(): Promise<void>;
|
|
402
|
+
}
|
|
403
|
+
|
|
341
404
|
/**
|
|
342
405
|
* A live recording, wrapped by `coresim.mm`'s `NativePrivateRecordingHandle` (video only,
|
|
343
406
|
* addressing CoreSimulator's own internally-tracked private recorder) or `NativeAVRecording`
|
|
@@ -420,6 +483,11 @@ export interface NativeDeviceHandle {
|
|
|
420
483
|
onAccessUnit: NativeVideoAccessUnitCallback,
|
|
421
484
|
onError: NativeVideoErrorCallback,
|
|
422
485
|
): Promise<NativeVideoStreamHandle>;
|
|
486
|
+
startJpegStream(
|
|
487
|
+
options: {displayId?: string; fps?: number; quality?: number; scale?: number} | undefined,
|
|
488
|
+
onFrame: NativeJpegFrameCallback,
|
|
489
|
+
onError: NativeVideoErrorCallback,
|
|
490
|
+
): Promise<NativeJpegStreamHandle>;
|
|
423
491
|
spawn(path: string, options: SpawnOptions | undefined, onExit: NativeSpawnExitCallback): Promise<NativeSpawnResult>;
|
|
424
492
|
}
|
|
425
493
|
|