@octane-xplat/camera 0.18.0 → 0.19.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/README.md +9 -9
- package/package.json +113 -103
- package/src/CameraView.android.tsrx +64 -21
- package/src/CameraView.ios.tsrx +48 -9
- package/src/CameraView.macos.tsrx +38 -7
- package/src/CameraView.web.tsrx +35 -11
- package/src/CameraView.windows.tsrx +56 -16
- package/src/host-movie.web.ts +22 -4
- package/src/layout-child.ts +3 -1
- package/src/layout-child.web.ts +6 -1
- package/src/layout-child.windows.ts +6 -1
- package/src/movie-metadata.web.ts +11 -1
- package/src/props.ts +28 -0
- package/src/session-backend.windows.ts +25 -9
- package/src/session-core.ts +4 -1
- package/src/style-merge.ts +3 -6
- package/src/synthetic-session.ts +7 -0
- package/src/types.ts +72 -1
- package/types/generated/.tsrx-typegen-manifest.json +38 -0
- package/types/generated/CameraView.android.d.ts +9 -0
- package/types/generated/CameraView.ios.d.ts +5 -0
- package/types/generated/CameraView.macos.d.ts +5 -0
- package/types/generated/CameraView.mobile.d.ts +5 -0
- package/types/generated/CameraView.web.d.ts +4 -0
- package/types/generated/CameraView.windows.d.ts +11 -0
- package/types/generated/camera-permission.mobile.d.ts +2 -0
- package/types/generated/camera-permission.windows.d.ts +6 -0
- package/types/generated/camera-session.ios.d.ts +2 -0
- package/types/generated/camera-session.macos.d.ts +10 -0
- package/types/generated/camera-session.windows.d.ts +9 -0
- package/types/generated/host-movie.web.d.ts +100 -0
- package/types/generated/index.d.ts +33 -0
- package/types/generated/index.web.d.ts +7 -0
- package/types/generated/layout-child.d.ts +11 -0
- package/types/generated/layout-child.web.d.ts +7 -0
- package/types/generated/layout-child.windows.d.ts +13 -0
- package/types/generated/movie-metadata.web.d.ts +9 -0
- package/types/generated/movie-storage.web.d.ts +5 -0
- package/types/generated/preview-tap.d.ts +7 -0
- package/types/{props.d.ts → generated/props.d.ts} +29 -1
- package/types/generated/session-backend.android.d.ts +3 -0
- package/types/generated/session-backend.d.ts +6 -0
- package/types/generated/session-backend.ios.d.ts +5 -0
- package/types/generated/session-backend.linux.d.ts +3 -0
- package/types/generated/session-backend.macos.d.ts +8 -0
- package/types/generated/session-backend.web.d.ts +3 -0
- package/types/generated/session-backend.windows.d.ts +37 -0
- package/types/{session-core.d.ts → generated/session-core.d.ts} +1 -1
- package/types/generated/session.d.ts +16 -0
- package/types/generated/style-merge.d.ts +8 -0
- package/types/{synthetic-session.d.ts → generated/synthetic-session.d.ts} +8 -1
- package/types/{types.d.ts → generated/types.d.ts} +70 -1
- package/LICENSE +0 -21
- package/types/index.d.ts +0 -48
package/src/types.ts
CHANGED
|
@@ -50,12 +50,15 @@ export type CameraCaptureErrorKind =
|
|
|
50
50
|
|
|
51
51
|
/** Structured diagnostic carried by failures and non-fatal warnings. */
|
|
52
52
|
export interface CaptureIssue {
|
|
53
|
+
/** Error category discriminator. */
|
|
53
54
|
kind: CameraCaptureErrorKind
|
|
54
55
|
/** Operation being attempted, e.g. 'startRecording', 'finalize'. */
|
|
55
56
|
operation: string
|
|
57
|
+
/** Human-readable failure description. */
|
|
56
58
|
message: string
|
|
59
|
+
/** Camera/mic authorization state. */
|
|
57
60
|
permission?: CameraPermissionKind
|
|
58
|
-
/**
|
|
61
|
+
/** Underlying platform error when one exists — diagnostic only, never required for control flow. */
|
|
59
62
|
cause?: unknown
|
|
60
63
|
}
|
|
61
64
|
|
|
@@ -65,6 +68,7 @@ export class CameraCaptureError extends Error implements CaptureIssue {
|
|
|
65
68
|
kind: CameraCaptureErrorKind
|
|
66
69
|
operation: string
|
|
67
70
|
permission?: CameraPermissionKind
|
|
71
|
+
/** Underlying platform error when one exists — diagnostic only. */
|
|
68
72
|
cause?: unknown
|
|
69
73
|
|
|
70
74
|
constructor(issue: Omit<CaptureIssue, 'cause'> & { cause?: unknown }) {
|
|
@@ -77,6 +81,7 @@ export class CameraCaptureError extends Error implements CaptureIssue {
|
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
84
|
+
/** Lens direction vocabulary. */
|
|
80
85
|
export type CameraFacing = 'front' | 'back'
|
|
81
86
|
|
|
82
87
|
/** A normalized position on the live preview as the user sees it:
|
|
@@ -85,10 +90,13 @@ export type CameraFacing = 'front' | 'back'
|
|
|
85
90
|
* mirroring. The `CameraView` `onTap` event and
|
|
86
91
|
* `CameraSession.focusAtPoint` share this space. */
|
|
87
92
|
export interface CameraPreviewPoint {
|
|
93
|
+
/** Focus/exposure point x, normalized 0-1. */
|
|
88
94
|
x: number
|
|
95
|
+
/** Focus/exposure point y, normalized 0-1. */
|
|
89
96
|
y: number
|
|
90
97
|
}
|
|
91
98
|
|
|
99
|
+
/** Capture orientation vocabulary. */
|
|
92
100
|
export type CameraOrientation =
|
|
93
101
|
| 'portrait'
|
|
94
102
|
| 'portraitUpsideDown'
|
|
@@ -100,6 +108,7 @@ export type CameraOrientation =
|
|
|
100
108
|
* hosts expose device identities instead of front/back semantics. */
|
|
101
109
|
export type CameraSelection = 'default' | 'front' | 'back' | { deviceId: string }
|
|
102
110
|
|
|
111
|
+
/** Configuration for opening a session. */
|
|
103
112
|
export interface CameraSessionConfig {
|
|
104
113
|
/** Lens or device identity. Default `'default'`: rear when available. */
|
|
105
114
|
camera?: CameraSelection
|
|
@@ -116,15 +125,25 @@ export interface CameraSessionConfig {
|
|
|
116
125
|
/** Resolution/frame-rate combination advertised by capability discovery.
|
|
117
126
|
* Entries are supported combinations, not independent lists. */
|
|
118
127
|
export interface CameraProfileCapability {
|
|
128
|
+
/** Capture profile (resolution/framerate preset). */
|
|
119
129
|
profile: 'standard'
|
|
130
|
+
/** Frame width in pixels. */
|
|
120
131
|
width: number
|
|
132
|
+
/** Frame height in pixels. */
|
|
121
133
|
height: number
|
|
134
|
+
/** Frames per second. */
|
|
122
135
|
frameRate: number
|
|
123
136
|
}
|
|
124
137
|
|
|
138
|
+
/** One usable camera device. */
|
|
125
139
|
export interface CameraDeviceInfo {
|
|
140
|
+
/** Device-stable camera identifier. */
|
|
141
|
+
/** Store-assigned id. */
|
|
142
|
+
|
|
126
143
|
id: string
|
|
144
|
+
/** Human-readable device name. */
|
|
127
145
|
label: string
|
|
146
|
+
/** Lens direction. */
|
|
128
147
|
facing?: CameraFacing
|
|
129
148
|
}
|
|
130
149
|
|
|
@@ -132,11 +151,15 @@ export interface CameraDeviceInfo {
|
|
|
132
151
|
* adapter or host cannot record (reason explains); `available` reflects
|
|
133
152
|
* current hardware/permission state and changes over time. */
|
|
134
153
|
export interface CameraSessionCapabilities {
|
|
154
|
+
/** A camera backend exists on this leaf. */
|
|
135
155
|
supported: boolean
|
|
136
156
|
/** Why capture is unsupported or currently unavailable. */
|
|
137
157
|
reason?: string
|
|
158
|
+
/** At least one usable camera is present. */
|
|
138
159
|
available: boolean
|
|
160
|
+
/** Detected camera devices. */
|
|
139
161
|
cameras: CameraDeviceInfo[]
|
|
162
|
+
/** Capture profiles the session can run. */
|
|
140
163
|
profiles: CameraProfileCapability[]
|
|
141
164
|
/** The session can add an audio track when permission allows. */
|
|
142
165
|
audio: boolean
|
|
@@ -154,8 +177,11 @@ export interface CameraSessionCapabilities {
|
|
|
154
177
|
durationLimit: 'native' | 'bestEffort'
|
|
155
178
|
/** Where `elapsedMs` comes from while recording. */
|
|
156
179
|
elapsedTime: 'nativeMedia' | 'estimated'
|
|
180
|
+
/** Where the clip was written. */
|
|
157
181
|
output: {
|
|
182
|
+
/** Output MIME type. */
|
|
158
183
|
mimeType: string
|
|
184
|
+
/** File container format. */
|
|
159
185
|
container: string
|
|
160
186
|
/** `appPrivateFile` output survives dispose and app restart;
|
|
161
187
|
* `originLocal` is browser storage subject to site-data clearing. */
|
|
@@ -165,22 +191,34 @@ export interface CameraSessionCapabilities {
|
|
|
165
191
|
}
|
|
166
192
|
}
|
|
167
193
|
|
|
194
|
+
/** Recorder lifecycle states. */
|
|
168
195
|
export type CameraRecorderState = 'idle' | 'starting' | 'recording' | 'finalizing' | 'disposed'
|
|
169
196
|
|
|
170
197
|
/** Frozen capture configuration reported once capture actually begins. */
|
|
171
198
|
export interface EffectiveCaptureConfig {
|
|
199
|
+
/** The CameraDeviceInfo.id in use. */
|
|
172
200
|
cameraId: string
|
|
201
|
+
/** Lens direction. */
|
|
173
202
|
facing?: CameraFacing
|
|
203
|
+
/** Whether audio capture is enabled for video. */
|
|
174
204
|
audio: boolean
|
|
205
|
+
/** Frame width in pixels. */
|
|
175
206
|
width: number
|
|
207
|
+
/** Frame height in pixels. */
|
|
176
208
|
height: number
|
|
209
|
+
/** Frames per second. */
|
|
177
210
|
frameRate: number
|
|
211
|
+
/** Capture orientation. */
|
|
178
212
|
orientation: CameraOrientation
|
|
213
|
+
/** Output MIME type. */
|
|
179
214
|
mimeType: string
|
|
215
|
+
/** File container format. */
|
|
180
216
|
container: string
|
|
181
217
|
}
|
|
182
218
|
|
|
219
|
+
/** Observable session state. */
|
|
183
220
|
export interface CameraSessionSnapshot {
|
|
221
|
+
/** Current lifecycle state. */
|
|
184
222
|
state: CameraRecorderState
|
|
185
223
|
/** Non-prompting last-known authorization, refreshed by `permissions()`
|
|
186
224
|
* and `requestPermission()`. */
|
|
@@ -189,9 +227,13 @@ export interface CameraSessionSnapshot {
|
|
|
189
227
|
cameraAvailable: boolean
|
|
190
228
|
/** An active preview view is attached to this session. */
|
|
191
229
|
previewAttached: boolean
|
|
230
|
+
/** Interrupted by the OS (call, route change, …). */
|
|
192
231
|
interrupted: boolean
|
|
232
|
+
/** Retry count for the current operation. */
|
|
193
233
|
attempt?: {
|
|
234
|
+
/** Device-stable camera identifier. */
|
|
194
235
|
id: string
|
|
236
|
+
/** Current lifecycle state. */
|
|
195
237
|
state: 'starting' | 'recording' | 'finalizing'
|
|
196
238
|
elapsedMs: number
|
|
197
239
|
configuration?: EffectiveCaptureConfig
|
|
@@ -216,26 +258,40 @@ export type MovieEndReason =
|
|
|
216
258
|
* native output. `synthetic` marks test-seam clips. */
|
|
217
259
|
export type MovieOutput =
|
|
218
260
|
| {
|
|
261
|
+
/** Error category discriminator. */
|
|
219
262
|
kind: 'nativeFile'
|
|
263
|
+
/** Store handle for the clip (gallery/native ref). */
|
|
220
264
|
resourceId: string
|
|
265
|
+
/** Filesystem URL of the written clip. */
|
|
266
|
+
/** Filesystem URL of the written clip. */
|
|
267
|
+
|
|
221
268
|
fileUrl: string
|
|
269
|
+
/** True for generated/test clips, not real captures. */
|
|
222
270
|
synthetic?: boolean
|
|
223
271
|
}
|
|
224
272
|
| {
|
|
273
|
+
/** Error category discriminator. */
|
|
225
274
|
kind: 'browserStorage'
|
|
275
|
+
/** Store handle for the clip (gallery/native ref). */
|
|
226
276
|
resourceId: string
|
|
227
277
|
retention: 'persistent' | 'bestEffort'
|
|
278
|
+
/** True for generated/test clips, not real captures. */
|
|
228
279
|
synthetic?: boolean
|
|
229
280
|
}
|
|
230
281
|
|
|
282
|
+
/** One finished recording. */
|
|
231
283
|
export interface MovieClip {
|
|
284
|
+
/** Where the clip was written. */
|
|
232
285
|
output: MovieOutput
|
|
286
|
+
/** Output MIME type. */
|
|
233
287
|
mimeType: string
|
|
234
288
|
/** Authoritative duration read from the finalized movie. */
|
|
235
289
|
durationMs: number
|
|
236
290
|
/** Presentation dimensions after the orientation transform. */
|
|
237
291
|
width: number
|
|
292
|
+
/** Frame height in pixels. */
|
|
238
293
|
height: number
|
|
294
|
+
/** Capture orientation. */
|
|
239
295
|
orientation: CameraOrientation
|
|
240
296
|
/** Whether the finalized movie actually contains an audio track.
|
|
241
297
|
* Missing requested audio is a failure, not silent capture. */
|
|
@@ -247,14 +303,18 @@ export interface MovieClip {
|
|
|
247
303
|
* app review decides whether to keep it. */
|
|
248
304
|
export type MovieOutcome =
|
|
249
305
|
| {
|
|
306
|
+
/** Error category discriminator. */
|
|
250
307
|
kind: 'clip'
|
|
251
308
|
clip: MovieClip
|
|
309
|
+
/** Why recording stopped. */
|
|
252
310
|
endReason: MovieEndReason
|
|
253
311
|
partial: boolean
|
|
254
312
|
warning?: CaptureIssue
|
|
255
313
|
}
|
|
256
314
|
| {
|
|
315
|
+
/** Error category discriminator. */
|
|
257
316
|
kind: 'failed'
|
|
317
|
+
/** Why recording stopped. */
|
|
258
318
|
endReason: MovieEndReason
|
|
259
319
|
stage: 'preparation' | 'capture' | 'finalization' | 'storage'
|
|
260
320
|
error: CaptureIssue
|
|
@@ -266,12 +326,14 @@ export type CameraSessionEvent =
|
|
|
266
326
|
| { type: 'started'; attemptId: string; configuration: EffectiveCaptureConfig }
|
|
267
327
|
| { type: 'finished'; attemptId: string; outcome: MovieOutcome }
|
|
268
328
|
| {
|
|
329
|
+
/** Output kind discriminator. */
|
|
269
330
|
type: 'interruption'
|
|
270
331
|
phase: 'began' | 'ended'
|
|
271
332
|
reason?: CameraInterruptionReason
|
|
272
333
|
}
|
|
273
334
|
| { type: 'availability'; available: boolean }
|
|
274
335
|
|
|
336
|
+
/** Why the OS interrupted capture. */
|
|
275
337
|
export type CameraInterruptionReason =
|
|
276
338
|
| 'background'
|
|
277
339
|
| 'audioInUse'
|
|
@@ -280,6 +342,7 @@ export type CameraInterruptionReason =
|
|
|
280
342
|
| 'systemPressure'
|
|
281
343
|
| 'unknown'
|
|
282
344
|
|
|
345
|
+
/** Options for session.startRecording(). */
|
|
283
346
|
export interface StartRecordingOptions {
|
|
284
347
|
/** Positive finite milliseconds. Enforcement precision comes from
|
|
285
348
|
* `capabilities().durationLimit`; the final duration is read from
|
|
@@ -298,11 +361,14 @@ export interface StartRecordingOptions {
|
|
|
298
361
|
* settles exactly once with the terminal outcome; repeated `stop()`
|
|
299
362
|
* joins the same finalization. */
|
|
300
363
|
export interface MovieTake {
|
|
364
|
+
/** Attempt identifier — unique per `startRecording` call. */
|
|
301
365
|
readonly id: string
|
|
366
|
+
/** Lifecycle phase; terminal value is `settled` (check `completion` for the outcome). */
|
|
302
367
|
readonly state: 'starting' | 'recording' | 'finalizing' | 'settled'
|
|
303
368
|
/** Elapsed capture time in milliseconds; excludes preparation and
|
|
304
369
|
* finalization. Source identified by `capabilities().elapsedTime`. */
|
|
305
370
|
readonly elapsedMs: number
|
|
371
|
+
/** Terminal outcome — resolves exactly once; `stop()` returns this same promise. */
|
|
306
372
|
readonly completion: Promise<MovieOutcome>
|
|
307
373
|
/** Requests stop and joins finalization. Returns `completion`. */
|
|
308
374
|
stop(): Promise<MovieOutcome>
|
|
@@ -313,10 +379,13 @@ export interface MovieTake {
|
|
|
313
379
|
export interface MovieOutputHandle {
|
|
314
380
|
/** Playable/readable location for the clip. */
|
|
315
381
|
readonly url: string
|
|
382
|
+
/** On-disk path when the clip is file-backed; absent for memory/remote storage. */
|
|
316
383
|
readonly fileUrl?: string
|
|
384
|
+
/** Free temporary access to the clip — never deletes it. */
|
|
317
385
|
release(): void
|
|
318
386
|
}
|
|
319
387
|
|
|
388
|
+
/** An owned camera session — dispose when done. */
|
|
320
389
|
export interface CameraSession {
|
|
321
390
|
/** Non-prompting permission inspection; may return `unknown` when the
|
|
322
391
|
* host cannot observe authorization. */
|
|
@@ -325,7 +394,9 @@ export interface CameraSession {
|
|
|
325
394
|
* serialized; a status other than `notDetermined` returns without
|
|
326
395
|
* prompting. */
|
|
327
396
|
requestPermission(kind: CameraPermissionKind): Promise<CameraPermissionStatus>
|
|
397
|
+
/** Hardware/OS limits for this session — polled live, so values can change as devices come and go. */
|
|
328
398
|
capabilities(): Promise<CameraSessionCapabilities>
|
|
399
|
+
/** Point-in-time session state — subscribe for changes. */
|
|
329
400
|
snapshot(): CameraSessionSnapshot
|
|
330
401
|
/** Ordered lifecycle events. A caller never loses a result by
|
|
331
402
|
* subscribing late — `completion` is authoritative. Listener
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"files": [
|
|
4
|
+
"CameraView.android.d.ts",
|
|
5
|
+
"CameraView.ios.d.ts",
|
|
6
|
+
"CameraView.macos.d.ts",
|
|
7
|
+
"CameraView.mobile.d.ts",
|
|
8
|
+
"CameraView.web.d.ts",
|
|
9
|
+
"CameraView.windows.d.ts",
|
|
10
|
+
"camera-permission.mobile.d.ts",
|
|
11
|
+
"camera-permission.windows.d.ts",
|
|
12
|
+
"camera-session.ios.d.ts",
|
|
13
|
+
"camera-session.macos.d.ts",
|
|
14
|
+
"camera-session.windows.d.ts",
|
|
15
|
+
"host-movie.web.d.ts",
|
|
16
|
+
"index.d.ts",
|
|
17
|
+
"index.web.d.ts",
|
|
18
|
+
"layout-child.d.ts",
|
|
19
|
+
"layout-child.web.d.ts",
|
|
20
|
+
"layout-child.windows.d.ts",
|
|
21
|
+
"movie-metadata.web.d.ts",
|
|
22
|
+
"movie-storage.web.d.ts",
|
|
23
|
+
"preview-tap.d.ts",
|
|
24
|
+
"props.d.ts",
|
|
25
|
+
"session-backend.android.d.ts",
|
|
26
|
+
"session-backend.d.ts",
|
|
27
|
+
"session-backend.ios.d.ts",
|
|
28
|
+
"session-backend.linux.d.ts",
|
|
29
|
+
"session-backend.macos.d.ts",
|
|
30
|
+
"session-backend.web.d.ts",
|
|
31
|
+
"session-backend.windows.d.ts",
|
|
32
|
+
"session-core.d.ts",
|
|
33
|
+
"session.d.ts",
|
|
34
|
+
"style-merge.d.ts",
|
|
35
|
+
"synthetic-session.d.ts",
|
|
36
|
+
"types.d.ts"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Attributes } from '@octane-xplat/jsx/intrinsics';
|
|
2
|
+
import type { CameraViewProps } from './props.js';
|
|
3
|
+
declare module '@octane-xplat/jsx/intrinsics' {
|
|
4
|
+
interface NativeElements<TElement> {
|
|
5
|
+
camerapreview: Attributes<TElement, {}>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** Live Android preview backed by CameraX. */
|
|
9
|
+
export declare function CameraView(props: CameraViewProps): unknown;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CameraViewProps } from './props.js';
|
|
2
|
+
/** Live iOS preview backed by AVFoundation. With `session`, the preview
|
|
3
|
+
* attaches to the session-owned AVCaptureSession so movie recording can
|
|
4
|
+
* share it; without one the view owns its session as before. */
|
|
5
|
+
export declare function CameraView(props: CameraViewProps): unknown;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CameraViewProps } from './props.js';
|
|
2
|
+
/** Live AppKit preview backed by AVFoundation. With `session`, the preview
|
|
3
|
+
* attaches to the session-owned AVCaptureSession so movie recording can
|
|
4
|
+
* share it; without one the view owns its session as before. */
|
|
5
|
+
export declare function CameraView(props: CameraViewProps): unknown;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { UniversalComponent } from 'octane/universal';
|
|
2
|
+
import type { CameraViewProps } from './props.js';
|
|
3
|
+
/** TypeScript fallback; the NativeScript resolver selects the .ios/.android
|
|
4
|
+
* implementation first at runtime. */
|
|
5
|
+
export declare const CameraView: UniversalComponent<CameraViewProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Attributes } from '@octane-xplat/jsx/intrinsics';
|
|
2
|
+
import type { CameraViewProps } from './props.js';
|
|
3
|
+
declare module '@octane-xplat/jsx/intrinsics' {
|
|
4
|
+
interface NativeElements<TElement> {
|
|
5
|
+
camerapreview: Attributes<TElement, {}>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** Live Windows preview backed by WinUI `CaptureElement` + `MediaCapture`.
|
|
9
|
+
* With `session`, the preview attaches to the session-owned capture so
|
|
10
|
+
* movie recording shares it; without one the view owns its capture. */
|
|
11
|
+
export declare function CameraView(props: CameraViewProps): unknown;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Windows camera-permission probe for preview-only `CameraView` callers.
|
|
2
|
+
* Uses `AppCapability` when projected and falls back to
|
|
3
|
+
* `DeviceAccessInformation`; both are non-prompting checks — only
|
|
4
|
+
* `RequestAccessAsync` may show the system prompt. */
|
|
5
|
+
export declare function cameraHardwarePresent(): boolean;
|
|
6
|
+
export declare function ensureCameraPermission(): Promise<boolean>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '@nativescript/macos-node-api';
|
|
2
|
+
export declare function cameraHardwarePresent(): boolean;
|
|
3
|
+
/** Preview-only permission entry point: prompts once from mount, mirrors the
|
|
4
|
+
* iOS legacy path. Session code should use `session.requestPermission` —
|
|
5
|
+
* explicit actions only. */
|
|
6
|
+
export declare function ensureCameraPermission(): Promise<boolean>;
|
|
7
|
+
/** Legacy preview-only path: a dedicated XplatCameraHost owns the preview
|
|
8
|
+
* session — shared with nothing, disposed with the view. The session-backed
|
|
9
|
+
* path goes through `attachSessionPreview` instead. */
|
|
10
|
+
export declare function startCameraPreview(view: object, _facing: 'front' | 'back', onReady?: () => void): () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Standalone (non-session) WinUI preview for `CameraView` without a
|
|
2
|
+
* `session` prop. Owns a private `MediaCapture` bound to a
|
|
3
|
+
* `CaptureElement`; the returned function stops preview and closes the
|
|
4
|
+
* device. Session-backed previews share their capture through
|
|
5
|
+
* `session-backend.windows.ts` instead. */
|
|
6
|
+
/** Attach a MediaCapture preview to the view's `CaptureElement`.
|
|
7
|
+
* `facing` maps to enclosure panels; desktop cameras without a panel fall
|
|
8
|
+
* back to the OS default — front/back is a preference, never a fabrication. */
|
|
9
|
+
export declare function startCameraPreview(view: any, facing: 'front' | 'back', onReady?: () => void): Promise<() => Promise<void>>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type HostClient } from '@octane-xplat/platform/host';
|
|
2
|
+
import type { MovieOutput, MovieOutputHandle } from './types.js';
|
|
3
|
+
export interface CameraHostServices {
|
|
4
|
+
camera: {
|
|
5
|
+
permissionStatus(options: {
|
|
6
|
+
kind: string;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
status: string;
|
|
9
|
+
}>;
|
|
10
|
+
requestPermission(options: {
|
|
11
|
+
kind: string;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
status: string;
|
|
14
|
+
}>;
|
|
15
|
+
movieDirectory(): Promise<{
|
|
16
|
+
fileUrl: string | null;
|
|
17
|
+
}>;
|
|
18
|
+
reserveMoviePath(options: {
|
|
19
|
+
fileUrl?: string;
|
|
20
|
+
container?: string;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
reservation: {
|
|
23
|
+
fileUrl: string;
|
|
24
|
+
} | null;
|
|
25
|
+
}>;
|
|
26
|
+
writeMovieFile(options: {
|
|
27
|
+
fileUrl: string;
|
|
28
|
+
base64: string;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
file: {
|
|
31
|
+
name: string;
|
|
32
|
+
uri: string;
|
|
33
|
+
} | null;
|
|
34
|
+
}>;
|
|
35
|
+
movieFileInfo(options: {
|
|
36
|
+
fileUrl: string;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
info: {
|
|
39
|
+
exists: boolean;
|
|
40
|
+
fileUrl?: string;
|
|
41
|
+
size?: number;
|
|
42
|
+
} | null;
|
|
43
|
+
}>;
|
|
44
|
+
readMovieFile(options: {
|
|
45
|
+
fileUrl: string;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
base64: string | null;
|
|
48
|
+
}>;
|
|
49
|
+
deleteMovieFile(options: {
|
|
50
|
+
fileUrl: string;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
removed: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
/** Optional chunked variants — a multi-hundred-MB movie must not
|
|
55
|
+
* round-trip through the bridge as one base64 payload. Absent on
|
|
56
|
+
* hosts built before the chunked contract; detected per client. */
|
|
57
|
+
writeMovieFileChunk?(options: {
|
|
58
|
+
fileUrl: string;
|
|
59
|
+
base64: string;
|
|
60
|
+
final?: boolean;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
file: {
|
|
63
|
+
name: string;
|
|
64
|
+
uri: string;
|
|
65
|
+
} | {
|
|
66
|
+
ok: boolean;
|
|
67
|
+
} | null;
|
|
68
|
+
}>;
|
|
69
|
+
readMovieFileChunk?(options: {
|
|
70
|
+
fileUrl: string;
|
|
71
|
+
offset: number;
|
|
72
|
+
length: number;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
base64: string | null;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export type CameraHost = HostClient<CameraHostServices>;
|
|
79
|
+
/** The camera-capable desktop host client, or null outside a qualified host.
|
|
80
|
+
* Only a confirmed client stays cached — a null result may be a transient
|
|
81
|
+
* transport or capabilities failure, so the next call probes again rather
|
|
82
|
+
* than sticking 'absent' for the page lifetime. */
|
|
83
|
+
export declare function cameraHost(): Promise<CameraHost | null>;
|
|
84
|
+
/** Reserve a host-side movie file. `destinationFileUrl` is validated
|
|
85
|
+
* host-side: it must be a new file inside the app-private storage root. */
|
|
86
|
+
export declare const reserveHostMovie: (host: CameraHost, options: {
|
|
87
|
+
destinationFileUrl?: string;
|
|
88
|
+
container?: string;
|
|
89
|
+
}) => Promise<{
|
|
90
|
+
fileUrl: string;
|
|
91
|
+
}>;
|
|
92
|
+
/** Commit finalized movie bytes to host-side app-private storage. Hosts
|
|
93
|
+
* with the chunked contract stream 4MB slices — a multi-hundred-MB
|
|
94
|
+
* recording no longer materializes ~3-4x its size across the bridge. */
|
|
95
|
+
export declare const commitHostMovie: (host: CameraHost, fileUrl: string, bytes: Blob) => Promise<MovieOutput>;
|
|
96
|
+
/** Drop an uncommitted host reservation after a failed attempt. */
|
|
97
|
+
export declare const removeHostReservation: (host: CameraHost, fileUrl: string) => Promise<void>;
|
|
98
|
+
/** Reopen a host-stored movie as a temporary playback URL. The durable
|
|
99
|
+
* reference remains `fileUrl`; the returned url lives until `release()`. */
|
|
100
|
+
export declare const openHostMovie: (host: CameraHost, output: MovieOutput) => Promise<MovieOutputHandle>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { CameraView } from './CameraView.mobile.js'
|
|
2
|
+
export type { CameraAccessibilityRole, CameraViewHandle, CameraViewProps } from './props.js'
|
|
3
|
+
export { createCameraSession } from './session.js'
|
|
4
|
+
export { CameraCaptureError } from './types.js'
|
|
5
|
+
export type {
|
|
6
|
+
CameraCaptureErrorKind,
|
|
7
|
+
CameraDeviceInfo,
|
|
8
|
+
CameraFacing,
|
|
9
|
+
CameraInterruptionReason,
|
|
10
|
+
CameraOrientation,
|
|
11
|
+
CameraPermissionKind,
|
|
12
|
+
CameraPermissionStatus,
|
|
13
|
+
CameraPreviewPoint,
|
|
14
|
+
CameraProfileCapability,
|
|
15
|
+
CameraRecorderState,
|
|
16
|
+
CameraSelection,
|
|
17
|
+
CameraSession,
|
|
18
|
+
CameraSessionCapabilities,
|
|
19
|
+
CameraSessionConfig,
|
|
20
|
+
CameraSessionEvent,
|
|
21
|
+
CameraSessionSnapshot,
|
|
22
|
+
CaptureIssue,
|
|
23
|
+
EffectiveCaptureConfig,
|
|
24
|
+
MovieClip,
|
|
25
|
+
MovieEndReason,
|
|
26
|
+
MovieOutcome,
|
|
27
|
+
MovieOutput,
|
|
28
|
+
MovieOutputHandle,
|
|
29
|
+
MovieTake,
|
|
30
|
+
StartRecordingOptions,
|
|
31
|
+
} from './types.js'
|
|
32
|
+
export { createMemoryCameraStorage, createSyntheticCameraSession } from './synthetic-session.js'
|
|
33
|
+
export type { SyntheticCameraScript, SyntheticCameraStorage } from './synthetic-session.js'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { CameraView } from './CameraView.web.js';
|
|
2
|
+
export type { CameraAccessibilityRole, CameraViewHandle, CameraViewProps } from './props.js';
|
|
3
|
+
export { createCameraSession } from './session.js';
|
|
4
|
+
export { CameraCaptureError } from './types.js';
|
|
5
|
+
export type { CameraCaptureErrorKind, CameraDeviceInfo, CameraFacing, CameraInterruptionReason, CameraOrientation, CameraPermissionKind, CameraPermissionStatus, CameraPreviewPoint, CameraProfileCapability, CameraRecorderState, CameraSelection, CameraSession, CameraSessionCapabilities, CameraSessionConfig, CameraSessionEvent, CameraSessionSnapshot, CaptureIssue, EffectiveCaptureConfig, MovieClip, MovieEndReason, MovieOutcome, MovieOutput, MovieOutputHandle, MovieTake, StartRecordingOptions, } from './types.js';
|
|
6
|
+
export { createMemoryCameraStorage, createSyntheticCameraSession } from './synthetic-session.js';
|
|
7
|
+
export type { SyntheticCameraScript, SyntheticCameraStorage } from './synthetic-session.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CameraViewProps } from './props.js';
|
|
2
|
+
/** NativeScript reads layout fields from a child view during parent layout. */
|
|
3
|
+
export declare function layoutChildProps(props: CameraViewProps, baseStyle?: Record<string, any> | string | undefined): {
|
|
4
|
+
style: string | Record<string, any>;
|
|
5
|
+
};
|
|
6
|
+
export declare function applyEscapeProps(view: any, props: {
|
|
7
|
+
ios?: any;
|
|
8
|
+
android?: any;
|
|
9
|
+
}): void;
|
|
10
|
+
export declare function nativeAccessibilityRole(role?: string): string | undefined;
|
|
11
|
+
export declare function nativeAccessibilityState(state?: CameraViewProps['accessibilityState']): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CameraViewProps } from './props.js';
|
|
2
|
+
/** Windows twins of the layout-child helpers — the unsuffixed module
|
|
3
|
+
* resolves the platform escape bag through `isIOS`, which has no Windows
|
|
4
|
+
* branch. Pure helpers are re-declared here to keep divergence at the file
|
|
5
|
+
* boundary. */
|
|
6
|
+
export declare function layoutChildProps(props: CameraViewProps, baseStyle?: Record<string, any> | string | undefined): {
|
|
7
|
+
style: string | Record<string, any>;
|
|
8
|
+
};
|
|
9
|
+
export declare function applyEscapeProps(view: any, props: {
|
|
10
|
+
windows?: any;
|
|
11
|
+
}): void;
|
|
12
|
+
export declare function nativeAccessibilityRole(role?: string): string | undefined;
|
|
13
|
+
export declare function nativeAccessibilityState(state?: CameraViewProps['accessibilityState']): string | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Read packet end timestamps and track metadata, never the wall-clock stop time. */
|
|
2
|
+
export declare function inspectMovie(bytes: Blob, audioRequested: boolean): Promise<{
|
|
3
|
+
durationMs: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
hasAudio: boolean;
|
|
7
|
+
mimeType: string;
|
|
8
|
+
orientation: 'unspecified';
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MovieClip, MovieOutput, MovieOutputHandle } from './types.js';
|
|
2
|
+
export declare function reserveMovie(): Promise<string>;
|
|
3
|
+
export declare function commitMovie(id: string, bytes: Blob, clip: MovieClip): Promise<void>;
|
|
4
|
+
export declare function removeReservation(id: string): Promise<void>;
|
|
5
|
+
export declare function openStoredMovie(output: MovieOutput): Promise<MovieOutputHandle>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CameraPreviewPoint } from './types.js';
|
|
2
|
+
/** Attach a notification-only 'tap' observer to a preview host view and
|
|
3
|
+
* report each tap as a `CameraPreviewPoint` normalized to the view's
|
|
4
|
+
* bounds. The tap gesture never consumes the touch — recognizers layered
|
|
5
|
+
* above the preview still see it. Platforms whose runtime never
|
|
6
|
+
* dispatches 'tap' simply never fire the callback. */
|
|
7
|
+
export declare function observePreviewTap(view: any, onTap: ((point: CameraPreviewPoint) => void) | undefined): () => void;
|