@nonstrict/recordkit 0.51.0 → 0.52.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/src/RecordKit.ts CHANGED
@@ -96,6 +96,8 @@ export class RecordKit extends EventEmitter {
96
96
  }
97
97
 
98
98
  /**
99
+ * A list of Mac displays that can be used for screen recording.
100
+ *
99
101
  * @group Discovery
100
102
  */
101
103
  async getDisplays(): Promise<Display[]> {
@@ -103,6 +105,8 @@ export class RecordKit extends EventEmitter {
103
105
  }
104
106
 
105
107
  /**
108
+ * A list of macOS windows that can be used for screen recording.
109
+ *
106
110
  * @group Discovery
107
111
  */
108
112
  async getWindows(): Promise<Window[]> {
@@ -110,13 +114,18 @@ export class RecordKit extends EventEmitter {
110
114
  }
111
115
 
112
116
  /**
117
+ * A list of cameras that are connected to the system.
118
+ *
119
+ * @param params.includeDeskView - Whether to include Desk View cameras in the results
113
120
  * @group Discovery
114
121
  */
115
- async getCameras(): Promise<Camera[]> {
116
- return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getCameras' }) as Camera[]
122
+ async getCameras(params?: { includeDeskView?: boolean }): Promise<Camera[]> {
123
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'Recorder', action: 'getCameras', params: { includeDeskView: params?.includeDeskView ?? false } }) as Camera[]
117
124
  }
118
125
 
119
126
  /**
127
+ * A list of microphones that are connected to the system.
128
+ *
120
129
  * @group Discovery
121
130
  */
122
131
  async getMicrophones(): Promise<Microphone[]> {
@@ -124,6 +133,8 @@ export class RecordKit extends EventEmitter {
124
133
  }
125
134
 
126
135
  /**
136
+ * A list of iOS devices that are connected to the system.
137
+ *
127
138
  * @group Discovery
128
139
  */
129
140
  async getAppleDevices(): Promise<AppleDevice[]> {
@@ -131,6 +142,8 @@ export class RecordKit extends EventEmitter {
131
142
  }
132
143
 
133
144
  /**
145
+ * A list of currently running applications that can be used for screen or audio recording.
146
+ *
134
147
  * @group Discovery
135
148
  */
136
149
  async getRunningApplications(): Promise<RunningApplication[]> {
@@ -138,6 +151,10 @@ export class RecordKit extends EventEmitter {
138
151
  }
139
152
 
140
153
  /**
154
+ * Indicates if camera can be used.
155
+ *
156
+ * Authorization status that indicates whether the user grants the app permission to capture video.
157
+ *
141
158
  * @group Permissions
142
159
  */
143
160
  async getCameraAuthorizationStatus(): Promise<AuthorizationStatus> {
@@ -145,6 +162,10 @@ export class RecordKit extends EventEmitter {
145
162
  }
146
163
 
147
164
  /**
165
+ * Indicates if microphone can be used.
166
+ *
167
+ * Authorization status that indicates whether the user grants the app permission to capture audio.
168
+ *
148
169
  * @group Permissions
149
170
  */
150
171
  async getMicrophoneAuthorizationStatus(): Promise<AuthorizationStatus> {
@@ -152,6 +173,8 @@ export class RecordKit extends EventEmitter {
152
173
  }
153
174
 
154
175
  /**
176
+ * Indicates if screen can be recorded.
177
+ *
155
178
  * @group Permissions
156
179
  */
157
180
  async getScreenRecordingAccess(): Promise<boolean> {
@@ -159,6 +182,38 @@ export class RecordKit extends EventEmitter {
159
182
  }
160
183
 
161
184
  /**
185
+ * Indicates if system audio can be recorded.
186
+ *
187
+ * @group Permissions
188
+ */
189
+ async getSystemAudioRecordingAccess(): Promise<boolean> {
190
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getSystemAudioRecordingAccess' }) as boolean
191
+ }
192
+
193
+ /**
194
+ * Indicates if keystroke events of other apps can be recorded via Input Monitoring.
195
+ *
196
+ * @group Permissions
197
+ */
198
+ async getInputMonitoringAccess(): Promise<boolean> {
199
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getInputMonitoringAccess' }) as boolean
200
+ }
201
+
202
+ /**
203
+ * Indicates if other apps can be controlled via Accessibility.
204
+ *
205
+ * @group Permissions
206
+ */
207
+ async getAccessibilityControlAccess(): Promise<boolean> {
208
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'getAccessibilityControlAccess' }) as boolean
209
+ }
210
+
211
+ /**
212
+ * Requests the user's permission to allow the app to capture the camera.
213
+ *
214
+ * Prompts the users if this is the first time requesting access, otherwise immediately returns.
215
+ *
216
+ * @returns Boolean value that indicates whether the user granted or denied access to your app.
162
217
  * @group Permissions
163
218
  */
164
219
  async requestCameraAccess(): Promise<boolean> {
@@ -166,6 +221,11 @@ export class RecordKit extends EventEmitter {
166
221
  }
167
222
 
168
223
  /**
224
+ * Requests the user's permission to allow the app to capture the microphone.
225
+ *
226
+ * Prompts the users if this is the first time requesting access, otherwise immediately returns.
227
+ *
228
+ * @returns Boolean value that indicates whether the user granted or denied access to your app.
169
229
  * @group Permissions
170
230
  */
171
231
  async requestMicrophoneAccess(): Promise<boolean> {
@@ -173,12 +233,64 @@ export class RecordKit extends EventEmitter {
173
233
  }
174
234
 
175
235
  /**
236
+ * Requests the user's permission to allow the app to capture the screen.
237
+ *
238
+ * If this is the first time requesting access, this shows dialog that lets th users open System Settings.
239
+ * In System Settings, the user can allow the app permission to do screen recording.
240
+ *
241
+ * Afterwards, the users needs to restart this app, for the permission to become active in the app.
242
+ *
176
243
  * @group Permissions
177
244
  */
178
245
  async requestScreenRecordingAccess(): Promise<void> {
179
246
  return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestScreenRecordingAccess' }) as void
180
247
  }
181
248
 
249
+ /**
250
+ * Requests the user's permission to allow the app to capture system audio.
251
+ *
252
+ * If this is the first time requesting access, this shows dialog that lets th users open System Settings.
253
+ * In System Settings, the user can allow the app permission to do screen recording.
254
+ *
255
+ * Afterwards, the users needs to restart this app, for the permission to become active in the app.
256
+ *
257
+ * @remarks Currently, system audio recording is currently implemented using ScreenCaptureKit,
258
+ * which means the users needs to grant screen recording access.
259
+ *
260
+ * @group Permissions
261
+ */
262
+ async requestSystemAudioRecordingAccess(): Promise<void> {
263
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestSystemAudioRecordingAccess' }) as void
264
+ }
265
+
266
+ /**
267
+ * Requests the users's permission to monitor keystrokes of other apps via Input Monitoring.
268
+ *
269
+ * If this is the first time requesting access, this shows dialog that lets th users open System Settings.
270
+ * In System Settings, the user can allow the app permission to monitor other apps.
271
+ *
272
+ * Afterwards, the users needs to restart this app, for the permission to become active in the app.
273
+ *
274
+ * @group Permissions
275
+ */
276
+ async requestInputMonitoringAccess(): Promise<void> {
277
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestInputMonitoringAccess' }) as void
278
+ }
279
+
280
+ /**
281
+ * Requests the users's permission to control other apps via Accessibility permissions.
282
+ *
283
+ * If this is the first time requesting access, this shows dialog that lets th users open System Settings.
284
+ * In System Settings, the user can allow the app permission to control apps.
285
+ *
286
+ * Afterwards, the users needs to restart this app, for the permission to become active in the app.
287
+ *
288
+ * @group Permissions
289
+ */
290
+ async requestAccessibilityControlAccess(): Promise<void> {
291
+ return await this.ipcRecordKit.nsrpc.perform({ type: 'AuthorizationStatus', action: 'requestAccessibilityControlAccess' }) as void
292
+ }
293
+
182
294
  async createRecorder(
183
295
  schema: {
184
296
  output_directory?: string
@@ -212,33 +324,82 @@ export type AuthorizationStatus =
212
324
  | 'authorized' // Application is authorized to access the hardware.
213
325
 
214
326
  /**
327
+ * An external iOS device that can be used for screen recording.
328
+ *
215
329
  * @group Discovery
216
330
  */
217
331
  export interface AppleDevice {
332
+ /** An identifier that uniquely identifies the device. */
218
333
  id: string;
334
+
335
+ /** A localized device name for display in the user interface. */
219
336
  name: string;
337
+
338
+ /** The model of this device. */
220
339
  model_id?: string;
340
+
341
+ /**
342
+ * The current availability state of this device.
343
+ *
344
+ * - `available`: Device can be recorded
345
+ * - `notPaired`: Device cannot be recorded because it is connected but not paired (recovery: "Tap 'Trust' on iPhone")
346
+ * - `notConnected`: Device cannot be recorded because it is currently not connected (recovery: "Connect via cable")
347
+ * - `pairedNeedsConnect`: Device cannot be recorded because it is paired but currently not connected (recovery: "(Re-)connect via cable")
348
+ * - `pairedNeedsReconnect`: Device cannot be recorded because it needs to be reconnected (recovery: "Unplug cable, and reconnect again")
349
+ */
221
350
  availability: 'available' | 'notPaired' | 'notConnected' | 'pairedNeedsConnect' | 'pairedNeedsReconnect'
222
351
  }
223
352
 
224
353
  /**
354
+ * A running macOS application of which windows or audio can be recorded.
355
+ *
225
356
  * @group Discovery
226
357
  */
227
358
  export interface RunningApplication {
359
+ /** Identifier for this application (process id). */
228
360
  id: number; // Int32
361
+
362
+ /** Display name of the application. */
229
363
  name?: string;
364
+
365
+ /** Bundle identifier of the application (e.g., "com.apple.Safari"). */
230
366
  bundle_identifier?: string;
367
+
368
+ /**
369
+ * The current availability state of this application.
370
+ *
371
+ * - `available`: Application can be recorded
372
+ * - `notRunning`: Application cannot be recorded because it is not (or no longer) running
373
+ */
231
374
  availability: 'available' | 'notRunning'
232
375
  }
233
376
 
234
377
  /**
378
+ * A camera whose video can be recorded.
379
+ *
235
380
  * @group Discovery
236
381
  */
237
382
  export interface Camera {
383
+ /** An identifier that uniquely identifies the camera. */
238
384
  id: string;
385
+
386
+ /** A localized camera name for display in the user interface. */
239
387
  name: string;
388
+
389
+ /** The model ID of this camera. */
240
390
  model_id: string;
391
+
392
+ /** The manufacturer of this camera. */
241
393
  manufacturer: string;
394
+
395
+ /**
396
+ * The current availability state of this camera.
397
+ *
398
+ * - `available`: Camera can be recorded
399
+ * - `lidClosed`: Camera cannot be recorded because the MacBook lid is closed (recovery: "Open MacBook lid")
400
+ * - `unknownSuspended`: Camera cannot be recorded because it is suspended for some unknown reason (recovery: "Unsuspend camera")
401
+ * - `notConnected`: Camera cannot be recorded because it is currently not connected (recovery: "Connect camera")
402
+ */
242
403
  availability: 'available' | 'lidClosed' | 'unknownSuspended' | 'notConnected'
243
404
 
244
405
  /**
@@ -251,35 +412,86 @@ export interface Camera {
251
412
  }
252
413
 
253
414
  /**
415
+ * A microphone whose audio can be recorded.
416
+ *
254
417
  * @group Discovery
255
418
  */
256
419
  export interface Microphone {
420
+ /** An identifier that uniquely identifies the microphone. */
257
421
  id: string;
422
+
423
+ /** A localized microphone name for display in the user interface. */
258
424
  name: string;
425
+
426
+ /** The model ID of this microphone. */
259
427
  model_id: string;
428
+
429
+ /** The manufacturer of this microphone. */
260
430
  manufacturer: string;
431
+
432
+ /**
433
+ * The current availability state of this microphone.
434
+ *
435
+ * - `available`: Microphone can be recorded
436
+ * - `lidClosed`: Microphone cannot be recorded because the MacBook lid is closed (recovery: "Open MacBook lid")
437
+ * - `unknownSuspended`: Microphone cannot be recorded because it is suspended for some unknown reason (recovery: "Unsuspend microphone")
438
+ * - `notConnected`: Microphone cannot be recorded because it is currently not connected (recovery: "Connect microphone")
439
+ */
261
440
  availability: 'available' | 'lidClosed' | 'unknownSuspended' | 'notConnected'
262
441
  }
263
442
 
264
443
  /**
444
+ * A Mac display that can be used for screen recording.
445
+ *
265
446
  * @group Discovery
266
447
  */
267
448
  export interface Display {
449
+ /** An identifier that uniquely identifies this Mac display (CGDirectDisplayID). */
268
450
  id: number; // UInt32
451
+
452
+ /** Name of this display. */
269
453
  localizedName?: string;
454
+
455
+ /** Frame of the display, relative to the main display. Uses top-left coordinate space. */
270
456
  frame: Bounds
457
+
458
+ /** Indicates if this is the main display. */
271
459
  isMain: boolean
460
+
461
+ /**
462
+ * The current availability state of this display.
463
+ *
464
+ * - `available`: A display can be recorded
465
+ * - `lidClosed`: A display cannot be recorded, because the MacBook lid is closed (recovery: "Open MacBook lid")
466
+ * - `notConnected`: A display cannot be screen recorded, because it is currently not connected (recovery: "Connect display")
467
+ */
468
+ availability: 'available' | 'lidClosed' | 'notConnected'
272
469
  }
273
470
 
274
471
  /**
472
+ * A macOS window that can be used for screen recording.
473
+ *
275
474
  * @group Discovery
276
475
  */
277
476
  export interface Window {
477
+ /** An identifier that uniquely identifies this macOS window (CGWindowID). */
278
478
  id: number; // UInt32
479
+
480
+ /** Title of the window. */
279
481
  title?: string;
482
+
483
+ /** Frame of the window, relative to the main display. Uses top-left coordinate space. */
280
484
  frame: Bounds
485
+
486
+ /**
487
+ * The level of the window relative to other windows.
488
+ */
281
489
  level: number // Int
490
+
491
+ /** Process ID of the application that owns this window. */
282
492
  application_process_id?: number // Int32
493
+
494
+ /** Name of the application that owns this window. */
283
495
  application_name?: string
284
496
  }
285
497
 
package/src/Recorder.ts CHANGED
@@ -136,6 +136,8 @@ export type RecorderSchemaItem =
136
136
  | ApplicationAudioSchema
137
137
 
138
138
  /**
139
+ * Creates a recorder item for a webcam movie file, using the provided microphone and camera. Output is stored in a RecordKit bundle.
140
+ *
139
141
  * @group Recording Schemas
140
142
  */
141
143
  export interface WebcamSchema {
@@ -146,6 +148,8 @@ export interface WebcamSchema {
146
148
  }
147
149
 
148
150
  /**
151
+ * Creates a recorder item for recording a single display. Output is stored in a RecordKit bundle.
152
+ *
149
153
  * @group Recording Schemas
150
154
  */
151
155
  export type DisplaySchema = {
@@ -170,6 +174,8 @@ export type DisplaySchema = {
170
174
  }
171
175
 
172
176
  /**
177
+ * Creates a recorder item for recording the initial crop of a window on a display. Output is stored in a RecordKit bundle.
178
+ *
173
179
  * @group Recording Schemas
174
180
  */
175
181
  export type WindowBasedCropSchema = {
@@ -192,6 +198,8 @@ export type WindowBasedCropSchema = {
192
198
  }
193
199
 
194
200
  /**
201
+ * Creates a recorder item for an Apple device screen recording, using the provided deviceID. Output is stored in a RecordKit bundle.
202
+ *
195
203
  * @group Recording Schemas
196
204
  */
197
205
  export interface AppleDeviceStaticOrientationSchema {
@@ -206,6 +214,11 @@ export interface AppleDeviceStaticOrientationSchema {
206
214
  export type SystemAudioMode = 'exclude' | 'include'
207
215
 
208
216
  /**
217
+ * Enumeration specifying the backend to use for system audio recording.
218
+ *
219
+ * - `screenCaptureKit`: Use ScreenCaptureKit for system audio recording.
220
+ * - `_beta_coreAudio`: This a beta feature, it is not fully implemented yet. Do not use in production. Currently only records single files in .caf format.
221
+ *
209
222
  * @group Recording Schemas
210
223
  */
211
224
  export type SystemAudioBackend = 'screenCaptureKit' | '_beta_coreAudio'
@@ -216,6 +229,11 @@ export type SystemAudioBackend = 'screenCaptureKit' | '_beta_coreAudio'
216
229
  export type AudioOutputOptionsType = 'singleFile' | 'segmented'
217
230
 
218
231
  /**
232
+ * Creates a recorder item for recording system audio. By default current process audio is excluded. Output is stored in a RecordKit bundle.
233
+ *
234
+ * When using `mode: 'exclude'`, all system audio is recorded except for excluded applications.
235
+ * When using `mode: 'include'`, only audio from specified applications is recorded.
236
+ *
219
237
  * @group Recording Schemas
220
238
  */
221
239
  export type SystemAudioSchema = {
@@ -253,6 +271,8 @@ export type SystemAudioSchema = {
253
271
  }
254
272
 
255
273
  /**
274
+ * Creates a recorder item for recording the audio of a single application. Output is stored in a RecordKit bundle.
275
+ *
256
276
  * @group Recording Schemas
257
277
  */
258
278
  export type ApplicationAudioSchema = {