@octane-xplat/camera 0.18.0 → 0.20.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 +2 -132
- package/package.json +108 -103
- package/platforms/android/java/com/octanexplat/camera/CameraPreviewView.java +24 -0
- package/platforms/android/java/com/octanexplat/camera/CameraSessionBridge.java +153 -21
- package/platforms/ios/src/XplatSwitchingMovieWriter.swift +557 -0
- package/src/CameraView.android.tsrx +194 -118
- package/src/CameraView.ios.tsrx +129 -76
- package/src/CameraView.macos.tsrx +108 -70
- package/src/CameraView.tsrx +2 -0
- package/src/CameraView.web.tsrx +160 -125
- package/src/CameraView.windows.tsrx +141 -92
- package/src/camera-host.macos.ts +1059 -0
- package/src/camera-permission.mobile.ts +85 -81
- package/src/camera-permission.windows.ts +56 -53
- package/src/camera-session.ios.ts +89 -61
- package/src/camera-session.macos.ts +51 -49
- package/src/camera-session.windows.ts +113 -105
- package/src/host-movie.web.ts +266 -222
- package/src/index.ts +28 -26
- package/src/index.web.ts +27 -25
- package/src/layout-child.ts +88 -79
- package/src/layout-child.web.ts +57 -51
- package/src/layout-child.windows.ts +82 -71
- package/src/movie-metadata.web.ts +87 -74
- package/src/movie-storage.web.ts +142 -135
- package/src/movie-writer.ios.ts +170 -0
- package/src/photo-lifecycle.macos.ts +60 -0
- package/src/photo-sheet.macos.ts +505 -0
- package/src/preview-display.ios.ts +69 -0
- package/src/preview-pinch.ts +41 -0
- package/src/preview-tap.ts +22 -21
- package/src/props.ts +118 -68
- package/src/recording-haptics.ios.ts +39 -0
- package/src/recording-source.web.ts +159 -0
- package/src/session-backend.android.ts +552 -410
- package/src/session-backend.ios.ts +1500 -1148
- package/src/session-backend.linux.ts +886 -860
- package/src/session-backend.macos.ts +697 -679
- package/src/session-backend.ts +51 -49
- package/src/session-backend.web.ts +1181 -867
- package/src/session-backend.windows.ts +1556 -1467
- package/src/session-core.ts +925 -711
- package/src/session.ts +12 -12
- package/src/style-merge.ts +43 -43
- package/src/synthetic-session.ts +392 -333
- package/src/types.ts +384 -239
- package/types/generated/.tsrx-typegen-manifest.json +18 -0
- package/types/generated/CameraView.d.ts +2 -0
- package/types/generated/CameraView.web.d.ts +4 -0
- package/types/generated/camera-host.macos.d.ts +33 -0
- package/types/generated/index.d.ts +34 -0
- package/types/generated/layout-child.web.d.ts +7 -0
- package/types/generated/photo-lifecycle.macos.d.ts +12 -0
- package/types/generated/photo-sheet.macos.d.ts +36 -0
- package/types/generated/props.d.ts +111 -0
- package/types/generated/session-backend.d.ts +6 -0
- package/types/{session-core.d.ts → generated/session-core.d.ts} +30 -1
- package/types/generated/session.d.ts +16 -0
- package/types/{synthetic-session.d.ts → generated/synthetic-session.d.ts} +15 -1
- package/types/{types.d.ts → generated/types.d.ts} +145 -2
- package/LICENSE +0 -21
- package/platforms/macos/src/CameraOwnership.swift +0 -22
- package/platforms/macos/src/PhotoCaptureLifecycle.swift +0 -34
- package/platforms/macos/src/XplatCameraHost.swift +0 -639
- package/platforms/macos/src/XplatPhotoCaptureSheet.swift +0 -192
- package/types/index.d.ts +0 -48
- package/types/props.d.ts +0 -61
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"files": [
|
|
4
|
+
"CameraView.d.ts",
|
|
5
|
+
"CameraView.web.d.ts",
|
|
6
|
+
"camera-host.macos.d.ts",
|
|
7
|
+
"index.d.ts",
|
|
8
|
+
"layout-child.web.d.ts",
|
|
9
|
+
"photo-lifecycle.macos.d.ts",
|
|
10
|
+
"photo-sheet.macos.d.ts",
|
|
11
|
+
"props.d.ts",
|
|
12
|
+
"session-backend.d.ts",
|
|
13
|
+
"session-core.d.ts",
|
|
14
|
+
"session.d.ts",
|
|
15
|
+
"synthetic-session.d.ts",
|
|
16
|
+
"types.d.ts"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface CameraHost {
|
|
2
|
+
attachPreview(view: object): string | null;
|
|
3
|
+
detachPreview(): void;
|
|
4
|
+
installObserver(listener: (message: string) => void): void;
|
|
5
|
+
permissionStatus(kind: string): string;
|
|
6
|
+
requestPermissionReply(kind: string, reply: (status: string) => void): void;
|
|
7
|
+
devices(): string;
|
|
8
|
+
audioDeviceAvailable(): boolean;
|
|
9
|
+
audioInputAttached(): boolean;
|
|
10
|
+
activeDeviceId(): string | null;
|
|
11
|
+
configure(options: {
|
|
12
|
+
cameraId?: string;
|
|
13
|
+
photo?: boolean;
|
|
14
|
+
audio?: boolean;
|
|
15
|
+
rotationAngle?: number;
|
|
16
|
+
}): string | null;
|
|
17
|
+
focusAtPoint(point: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}): boolean;
|
|
21
|
+
supportsRotationAngles(): boolean;
|
|
22
|
+
movieDirectory(): string | null;
|
|
23
|
+
startRecording(path: string, maximumDurationMs: number): string | null;
|
|
24
|
+
stopRecording(): void;
|
|
25
|
+
recording(): boolean;
|
|
26
|
+
recordedMs(): number;
|
|
27
|
+
previewSize(): string;
|
|
28
|
+
capturePhoto(reply: (data: unknown) => void): string | null;
|
|
29
|
+
dispose(): void;
|
|
30
|
+
}
|
|
31
|
+
/** One capture host: an AVCaptureSession shared by an optional preview layer,
|
|
32
|
+
* one still-photo output and one movie-file output at a time. */
|
|
33
|
+
export declare function createCameraHost(): CameraHost;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { CameraView } from './CameraView.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
|
+
|
|
33
|
+
export { createMemoryCameraStorage, createSyntheticCameraSession } from './synthetic-session.js'
|
|
34
|
+
export type { SyntheticCameraScript, SyntheticCameraStorage } from './synthetic-session.js'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Fences every asynchronous permission, preview and shutter result — the
|
|
2
|
+
* PhotoCaptureLifecycle state machine, now plain JS. */
|
|
3
|
+
export type Phase = 'idle' | 'preparing' | 'preview' | 'capturing' | 'finished';
|
|
4
|
+
export declare function createPhotoCaptureLifecycle(): {
|
|
5
|
+
readonly phase: Phase;
|
|
6
|
+
prepare(): number | null;
|
|
7
|
+
ready(token: number): boolean;
|
|
8
|
+
capture(): number | null;
|
|
9
|
+
accepts(token: number): boolean;
|
|
10
|
+
finish(): boolean;
|
|
11
|
+
};
|
|
12
|
+
export type PhotoCaptureLifecycle = ReturnType<typeof createPhotoCaptureLifecycle>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const SheetBase: any;
|
|
2
|
+
declare class XplatPhotoCaptureSheet extends SheetBase {
|
|
3
|
+
static ObjCProtocols: any[];
|
|
4
|
+
static ObjCExposedMethods: Record<string, unknown>;
|
|
5
|
+
private _host;
|
|
6
|
+
private _life;
|
|
7
|
+
private get host();
|
|
8
|
+
private get life();
|
|
9
|
+
private sheet;
|
|
10
|
+
private parent;
|
|
11
|
+
private reply;
|
|
12
|
+
private timeout;
|
|
13
|
+
private closeObserver;
|
|
14
|
+
private preview;
|
|
15
|
+
private captureButton;
|
|
16
|
+
private statusLabel;
|
|
17
|
+
private options;
|
|
18
|
+
private disposed;
|
|
19
|
+
private _operationTimeout;
|
|
20
|
+
private get operationTimeout();
|
|
21
|
+
permissionStatus(): string;
|
|
22
|
+
presentReply(options: any, reply: (result: string | null) => void): void;
|
|
23
|
+
['present:reply:'](options: any, reply: (result: string | null) => void): void;
|
|
24
|
+
presentOnWindow(parent: any, options: Record<string, unknown>, reply: (result: string | null) => void): void;
|
|
25
|
+
private deadline;
|
|
26
|
+
['capturePhoto'](): void;
|
|
27
|
+
private persist;
|
|
28
|
+
private persistWrite;
|
|
29
|
+
['cancelPhoto'](): void;
|
|
30
|
+
['windowShouldClose:'](_sender: any): boolean;
|
|
31
|
+
private complete;
|
|
32
|
+
discard(path: any): void;
|
|
33
|
+
['discard:'](path: any): void;
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|
|
36
|
+
export { XplatPhotoCaptureSheet };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
2
|
+
import type { CameraPinchEvent, CameraPreviewPoint, CameraSession } from './types.js';
|
|
3
|
+
/** Accessibility roles the preview accepts. */
|
|
4
|
+
export type CameraAccessibilityRole = 'button' | 'link' | 'search' | 'image' | 'heading' | 'adjustable' | 'summary' | 'text' | 'none' | 'progressbar' | 'checkbox' | 'switch' | 'radio' | 'spinbutton' | 'tab';
|
|
5
|
+
/** Imperative handle exposed through the CameraView `ref`. */
|
|
6
|
+
export interface CameraViewHandle {
|
|
7
|
+
/** The native preview surface (`HTMLVideoElement` on web). */
|
|
8
|
+
native: any;
|
|
9
|
+
}
|
|
10
|
+
/** Props for the CameraView element. */
|
|
11
|
+
export interface CameraViewProps {
|
|
12
|
+
/** Class list applied to the preview element. */
|
|
13
|
+
className?: any;
|
|
14
|
+
/** Inline style (string CSS or object). */
|
|
15
|
+
style?: any;
|
|
16
|
+
/** Element id passed through to the host element. */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** Zero-based row index in the parent grid. */
|
|
19
|
+
row?: number;
|
|
20
|
+
/** Zero-based column index. */
|
|
21
|
+
col?: number;
|
|
22
|
+
/** Row tracks to span (>= 1). */
|
|
23
|
+
rowSpan?: number;
|
|
24
|
+
/** Column tracks to span (>= 1). */
|
|
25
|
+
colSpan?: number;
|
|
26
|
+
/** Edge of the parent dock layout this child pins to. */
|
|
27
|
+
dock?: 'left' | 'top' | 'right' | 'bottom';
|
|
28
|
+
/** Absolute x offset in dips. */
|
|
29
|
+
left?: number;
|
|
30
|
+
/** Absolute y offset in dips. */
|
|
31
|
+
top?: number;
|
|
32
|
+
/** Flex grow factor. */
|
|
33
|
+
flexGrow?: number;
|
|
34
|
+
/** Flex shrink factor. */
|
|
35
|
+
flexShrink?: number;
|
|
36
|
+
/** Cross-axis self alignment. */
|
|
37
|
+
alignSelf?: string;
|
|
38
|
+
/** Sibling ordering. */
|
|
39
|
+
order?: number;
|
|
40
|
+
/** Expose to assistive tech as an accessibility element. */
|
|
41
|
+
accessible?: boolean;
|
|
42
|
+
/** Spoken name for assistive tech. */
|
|
43
|
+
accessibilityLabel?: string;
|
|
44
|
+
/** Semantic role mapped per platform. */
|
|
45
|
+
accessibilityRole?: CameraAccessibilityRole;
|
|
46
|
+
/** Spoken hint describing what activating does. */
|
|
47
|
+
accessibilityHint?: string;
|
|
48
|
+
/** Spoken current value text. */
|
|
49
|
+
accessibilityValue?: string;
|
|
50
|
+
/** State flags merged into the platform a11y state. */
|
|
51
|
+
accessibilityState?: {
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
selected?: boolean;
|
|
54
|
+
checked?: boolean;
|
|
55
|
+
};
|
|
56
|
+
/** Live-region announcements: polite queues, assertive interrupts. */
|
|
57
|
+
accessibilityLiveRegion?: 'none' | 'polite' | 'assertive';
|
|
58
|
+
/** Shared camera owner enabling movie recording. When set, the preview
|
|
59
|
+
* attaches to the session's acquisition instead of owning one, and
|
|
60
|
+
* `facing` must be omitted — camera selection lives on the session. */
|
|
61
|
+
session?: CameraSession;
|
|
62
|
+
/** Lens — defaults to the rear camera. Invalid together with `session`. */
|
|
63
|
+
facing?: 'front' | 'back';
|
|
64
|
+
/** Default true. False releases the preview session. */
|
|
65
|
+
active?: boolean;
|
|
66
|
+
/** Fires after the preview surface starts — session-backed previews
|
|
67
|
+
* deliver it when the camera source is feeding the shared session and
|
|
68
|
+
* recording can be admitted (`session.startRecording` would not be
|
|
69
|
+
* rejected for an idle source). It is an admission signal, not a
|
|
70
|
+
* displayed-frame signal: use `onDisplayReady` when a visible first
|
|
71
|
+
* frame must precede an automatic recording. */
|
|
72
|
+
onReady?: () => void;
|
|
73
|
+
/** Fires when the attached surface first displays a live camera frame,
|
|
74
|
+
* separate from `onReady` admission. Apps that record automatically
|
|
75
|
+
* should wait for this so capture never starts before the user can
|
|
76
|
+
* see the preview. iOS 13+ reports `AVCaptureVideoPreviewLayer`
|
|
77
|
+
* `previewing` in non-empty bounds; Android reports the PreviewView
|
|
78
|
+
* `STREAMING` state; web reports the first presented video frame.
|
|
79
|
+
* Fires again when the displayed preview resumes after an
|
|
80
|
+
* interruption. Hosts without a distinct display signal — macOS,
|
|
81
|
+
* Windows, Linux — never fire it. */
|
|
82
|
+
onDisplayReady?: () => void;
|
|
83
|
+
/** Camera/preview errors. */
|
|
84
|
+
onError?: (error: {
|
|
85
|
+
message?: string;
|
|
86
|
+
}) => void;
|
|
87
|
+
/** Notification-only tap event — fires with the normalized
|
|
88
|
+
* preview-space position (`CameraPreviewPoint`) and never consumes
|
|
89
|
+
* the gesture, so recognizers layered above the preview (double-tap,
|
|
90
|
+
* pan) still run. Pair with `session.focusAtPoint` for tap-to-focus.
|
|
91
|
+
* Delivered on iOS, Android, and web; desktop runtimes do not dispatch
|
|
92
|
+
* it yet. */
|
|
93
|
+
onTap?: (point: CameraPreviewPoint) => void;
|
|
94
|
+
/** Pinch gesture on the preview — fires with the cumulative `scale`
|
|
95
|
+
* and a preview-space `focus` (`CameraPinchEvent`). Notification-only:
|
|
96
|
+
* it never consumes the gesture. Pair with `session.setZoom` for
|
|
97
|
+
* pinch-to-zoom; a pinch state of `began` is also the point to suspend
|
|
98
|
+
* any ancestor pull-down gesture for. Delivered on iOS and Android;
|
|
99
|
+
* desktop runtimes do not dispatch it yet. */
|
|
100
|
+
onPinch?: (event: CameraPinchEvent) => void;
|
|
101
|
+
/** Native preview surface for platform-specific controls. */
|
|
102
|
+
ref?: Octane.Ref<CameraViewHandle>;
|
|
103
|
+
/** Platform-specific properties applied to the preview surface. */
|
|
104
|
+
ios?: Record<string, any>;
|
|
105
|
+
/** Platform escape hatch — same bag contract as `ios`. */
|
|
106
|
+
android?: Record<string, any>;
|
|
107
|
+
/** Platform escape hatch — same bag contract as `ios`. */
|
|
108
|
+
web?: Record<string, any>;
|
|
109
|
+
/** Platform escape hatch — same bag contract as `ios`. */
|
|
110
|
+
windows?: Record<string, any>;
|
|
111
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CameraSessionBackend } from './session-core.js';
|
|
2
|
+
import type { CameraSessionConfig } from './types.js';
|
|
3
|
+
/** Default adapter for platforms without a movie-capture implementation
|
|
4
|
+
* yet. Honest `unsupported` reporting — never fabricated capture. Kept
|
|
5
|
+
* platform-pure so web and native fallback builds share it. */
|
|
6
|
+
export declare function createSessionBackend(_config: CameraSessionConfig): CameraSessionBackend;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CameraInterruptionReason, CameraPermissionKind, CameraPermissionStatus, CameraPreviewPoint, CameraSession, CameraSessionCapabilities, CameraSessionConfig, CameraSessionEvent, CameraSessionSnapshot, CaptureIssue, EffectiveCaptureConfig, MovieEndReason, MovieOutput, MovieOutputHandle, MovieTake, StartRecordingOptions } from './types';
|
|
1
|
+
import type { CameraInterruptionReason, CameraDeviceInfo, CameraPermissionKind, CameraPermissionStatus, CameraPreviewPoint, CameraSession, CameraSessionCapabilities, CameraSessionConfig, CameraSessionEvent, CameraSessionSnapshot, CameraSelection, CameraZoomState, CaptureIssue, EffectiveCaptureConfig, MovieEndReason, MovieOutput, MovieOutputHandle, MovieTake, StartRecordingOptions } from './types.js';
|
|
2
2
|
/** Result an adapter reports when a capture attempt settles. Media
|
|
3
3
|
* metadata is already read from the finalized movie by the adapter. */
|
|
4
4
|
export type BackendSettle = {
|
|
@@ -39,7 +39,14 @@ export interface BackendCaptureRequest {
|
|
|
39
39
|
/** Adapter-owned preview attach. `listener` reports preview lifecycle;
|
|
40
40
|
* returns the detach function. */
|
|
41
41
|
export interface BackendPreviewListener {
|
|
42
|
+
/** The session can admit `startRecording` — recording-admission
|
|
43
|
+
* readiness, not a displayed-frame signal. */
|
|
42
44
|
onReady?: () => void;
|
|
45
|
+
/** The attached surface displayed its first live camera frame — a
|
|
46
|
+
* display-readiness signal, separate from `onReady` admission.
|
|
47
|
+
* Adapters fire it on each transition into displayed state; hosts
|
|
48
|
+
* without a distinct display signal never fire it. */
|
|
49
|
+
onDisplayReady?: () => void;
|
|
43
50
|
onError?: (issue: CaptureIssue) => void;
|
|
44
51
|
}
|
|
45
52
|
/** Platform adapter surface driven by the shared session core. Adapters
|
|
@@ -60,10 +67,19 @@ export interface CameraSessionBackend {
|
|
|
60
67
|
attachPreview(host: unknown, listener?: BackendPreviewListener): () => void;
|
|
61
68
|
/** Replace configuration while idle; throws CameraCaptureError. */
|
|
62
69
|
configure?(config: CameraSessionConfig): void;
|
|
70
|
+
/** Live camera-only swap. The adapter holds recorded video and keeps
|
|
71
|
+
* audio/output alive. Cancellation must retire late hardware callbacks. */
|
|
72
|
+
switchCamera?(camera: CameraSelection): BackendCameraSwitch;
|
|
63
73
|
/** Meter one autofocus/auto-exposure pass at a normalized preview-space
|
|
64
74
|
* point — the tap-to-focus primitive. Absent means the adapter cannot
|
|
65
75
|
* meter at a point; the core turns it into a no-op. */
|
|
66
76
|
focusAtPoint?(point: CameraPreviewPoint): void;
|
|
77
|
+
/** Live zoom state of the bound device; absent or `undefined` means the
|
|
78
|
+
* adapter exposes no zoom control. */
|
|
79
|
+
zoomState?(): CameraZoomState | undefined;
|
|
80
|
+
/** Write a zoom ratio already clamped by the core. Absent means the
|
|
81
|
+
* adapter exposes no zoom control. */
|
|
82
|
+
setZoom?(ratio: number): void;
|
|
67
83
|
/** Synchronous platform-specific admission checks; creates no attempt on failure. */
|
|
68
84
|
validateStart?(options: StartRecordingOptions): void;
|
|
69
85
|
/** Begin capture for an admitted attempt. Async failures settle via
|
|
@@ -84,6 +100,13 @@ export interface CameraSessionBackend {
|
|
|
84
100
|
/** Lifecycle observations the adapter emits at any time. */
|
|
85
101
|
setObserver(observer: BackendObserver | undefined): void;
|
|
86
102
|
}
|
|
103
|
+
export interface BackendCameraSwitch {
|
|
104
|
+
completion: Promise<CameraDeviceInfo>;
|
|
105
|
+
/** Commit a provisionally acquired source after the lifecycle recheck.
|
|
106
|
+
* Cancellation must remain effective until this synchronous handoff. */
|
|
107
|
+
commit?(): void;
|
|
108
|
+
cancel(): void;
|
|
109
|
+
}
|
|
87
110
|
export interface BackendObserver {
|
|
88
111
|
interruption(phase: 'began' | 'ended', reason?: CameraInterruptionReason): void;
|
|
89
112
|
availability(available: boolean): void;
|
|
@@ -111,6 +134,8 @@ export declare class SharedCameraSession implements CameraSession {
|
|
|
111
134
|
private disposed;
|
|
112
135
|
private lastCapabilities;
|
|
113
136
|
private requestChains;
|
|
137
|
+
private activeCamera;
|
|
138
|
+
private cameraSwitch;
|
|
114
139
|
private attempt;
|
|
115
140
|
constructor(backend: CameraSessionBackend, config: CameraSessionConfig);
|
|
116
141
|
/** Package-internal: attach a preview host to this session. */
|
|
@@ -135,6 +160,10 @@ export declare class SharedCameraSession implements CameraSession {
|
|
|
135
160
|
requestPermission(kind: CameraPermissionKind): Promise<CameraPermissionStatus>;
|
|
136
161
|
capabilities(): Promise<CameraSessionCapabilities>;
|
|
137
162
|
focusAtPoint(point: CameraPreviewPoint): void;
|
|
163
|
+
zoomState(): CameraZoomState | undefined;
|
|
164
|
+
setZoom(ratio: number): void;
|
|
165
|
+
private assertConfigurable;
|
|
166
|
+
switchCamera(camera: CameraSelection): Promise<void>;
|
|
138
167
|
configure(next: Partial<CameraSessionConfig>): Promise<void>;
|
|
139
168
|
private validateCameraSelection;
|
|
140
169
|
private requestStop;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BackendPreviewListener } from './session-core.js';
|
|
2
|
+
import type { CameraSession, CameraSessionConfig } from './types.js';
|
|
3
|
+
/** Create a shared camera owner: one acquisition shared between a
|
|
4
|
+
* `CameraView` preview (`session` prop) and at most one movie-recording
|
|
5
|
+
* attempt. Creating a session never prompts for permission or acquires
|
|
6
|
+
* hardware — both happen when a session-backed preview activates or a
|
|
7
|
+
* permission request runs.
|
|
8
|
+
*
|
|
9
|
+
* Recording support is delivered per platform; `capabilities()` reports
|
|
10
|
+
* honest `supported`/`available` state on every host. */
|
|
11
|
+
export declare function createCameraSession(config?: CameraSessionConfig): CameraSession;
|
|
12
|
+
/** Package-internal: attach `host` as the session's preview surface.
|
|
13
|
+
* Used by `CameraView` when its `session` prop is set; detaching the
|
|
14
|
+
* returned function requests stop on an in-flight attempt and releases
|
|
15
|
+
* camera ownership once finalization settles. */
|
|
16
|
+
export declare function attachSessionPreview(session: CameraSession, host: unknown, listener?: BackendPreviewListener): () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CameraInterruptionReason, CameraPermissionStatus, CameraPreviewPoint, CameraSession, CameraSessionConfig } from './types';
|
|
1
|
+
import type { CameraInterruptionReason, CameraPermissionStatus, CameraPreviewPoint, CameraSession, CameraSessionConfig } from './types.js';
|
|
2
2
|
/** Development/testing seam — a deterministic camera source that drives
|
|
3
3
|
* the shared session state machine without hardware. NOT a production
|
|
4
4
|
* recording source: outcomes carry `synthetic: true` on their output so
|
|
@@ -9,6 +9,7 @@ import type { CameraInterruptionReason, CameraPermissionStatus, CameraPreviewPoi
|
|
|
9
9
|
* partial completions, and failures.
|
|
10
10
|
*/
|
|
11
11
|
export interface SyntheticCameraScript {
|
|
12
|
+
/** Storage access state. */
|
|
12
13
|
permission: {
|
|
13
14
|
camera: CameraPermissionStatus;
|
|
14
15
|
microphone: CameraPermissionStatus;
|
|
@@ -33,16 +34,29 @@ export interface SyntheticCameraScript {
|
|
|
33
34
|
/** When set, each `focusAtPoint` call pushes its normalized point
|
|
34
35
|
* here so a spec can observe metering requests. */
|
|
35
36
|
focusRequests?: CameraPreviewPoint[];
|
|
37
|
+
/** When set, the seam reports zoom control: `zoomState()` returns a
|
|
38
|
+
* copy and `setZoom` writes `zoom` here so specs observe requests. */
|
|
39
|
+
zoom?: {
|
|
40
|
+
zoom: number;
|
|
41
|
+
minZoom: number;
|
|
42
|
+
maxZoom: number;
|
|
43
|
+
};
|
|
36
44
|
}
|
|
45
|
+
/** Storage backing for synthetic/test camera clips. */
|
|
37
46
|
export interface SyntheticCameraStorage {
|
|
47
|
+
/** Write a synthetic clip to storage. */
|
|
38
48
|
write(path: string, bytes: Uint8Array): void | Promise<void>;
|
|
49
|
+
/** Read a stored clip. */
|
|
39
50
|
read(path: string): Uint8Array | undefined | Promise<Uint8Array | undefined>;
|
|
51
|
+
/** Remove a stored clip; optional — reopen paths degrade gracefully without it. */
|
|
40
52
|
delete?(path: string): void | Promise<void>;
|
|
53
|
+
/** Probe for a stored clip without reading it. */
|
|
41
54
|
exists?(path: string): boolean | Promise<boolean>;
|
|
42
55
|
}
|
|
43
56
|
/** In-memory storage for the seam — a `fileUrl`-shaped map so outcomes
|
|
44
57
|
* exercise the same reopen path without touching a real filesystem. */
|
|
45
58
|
export declare function createMemoryCameraStorage(): SyntheticCameraStorage & {
|
|
59
|
+
/** Stored clip bytes keyed by path — specs assert on this map directly. */
|
|
46
60
|
files: Map<string, Uint8Array>;
|
|
47
61
|
};
|
|
48
62
|
/** Create a `CameraSession` backed by the deterministic synthetic source.
|