@microblink/camera-manager 7.0.0-next.3 → 7.0.0-next.4
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/dist/camera-manager.js +916 -7277
- package/package.json +12 -49
- package/types/core/Camera.d.ts +3 -0
- package/types/core/Camera.d.ts.map +1 -1
- package/types/core/Camera.test.d.ts +3 -0
- package/types/core/Camera.test.d.ts.map +1 -1
- package/types/core/CameraManager.d.ts +11 -2
- package/types/core/CameraManager.d.ts.map +1 -1
- package/types/core/cameraManagerStore.d.ts +3 -0
- package/types/core/cameraManagerStore.d.ts.map +1 -1
- package/types/core/cameraNames.d.ts +3 -0
- package/types/core/cameraNames.d.ts.map +1 -1
- package/types/core/cameraUtils.d.ts +3 -0
- package/types/core/cameraUtils.d.ts.map +1 -1
- package/types/core/createCustomImageData.d.ts +3 -0
- package/types/core/createCustomImageData.d.ts.map +1 -1
- package/types/core/imageDataUtils.d.ts +3 -0
- package/types/core/imageDataUtils.d.ts.map +1 -1
- package/types/core/iosCameraNames.d.ts +3 -0
- package/types/core/iosCameraNames.d.ts.map +1 -1
- package/types/core/utils.d.ts +3 -0
- package/types/core/utils.d.ts.map +1 -1
- package/types/core/videoToImageData.d.ts +3 -0
- package/types/core/videoToImageData.d.ts.map +1 -1
- package/types/index.d.ts +7 -0
- package/types/index.d.ts.map +1 -1
- package/types/media-mock/MediaMocker.d.ts +3 -0
- package/types/media-mock/MediaMocker.d.ts.map +1 -1
- package/types/media-mock/createInputDeviceInfo.d.ts +3 -0
- package/types/media-mock/createInputDeviceInfo.d.ts.map +1 -1
- package/types/media-mock/defineProperty.d.ts +3 -0
- package/types/media-mock/defineProperty.d.ts.map +1 -1
- package/types/media-mock/fake-devices.d.ts +3 -0
- package/types/media-mock/fake-devices.d.ts.map +1 -1
- package/types/media-mock/utils.d.ts +3 -0
- package/types/media-mock/utils.d.ts.map +1 -1
- package/types/tests/camera-picking.test.d.ts +3 -0
- package/types/tests/camera-picking.test.d.ts.map +1 -1
- package/types/ui/CameraSelector.d.ts +3 -0
- package/types/ui/CameraSelector.d.ts.map +1 -1
- package/types/ui/CameraUiStoreContext.d.ts +5 -2
- package/types/ui/CameraUiStoreContext.d.ts.map +1 -1
- package/types/ui/CaptureScreen.d.ts +3 -0
- package/types/ui/CaptureScreen.d.ts.map +1 -1
- package/types/ui/ErrorAlert.d.ts +3 -0
- package/types/ui/ErrorAlert.d.ts.map +1 -1
- package/types/ui/Header.d.ts +3 -0
- package/types/ui/Header.d.ts.map +1 -1
- package/types/ui/LocalizationContext.d.ts +3 -0
- package/types/ui/LocalizationContext.d.ts.map +1 -1
- package/types/ui/RootComponent.d.ts +3 -0
- package/types/ui/RootComponent.d.ts.map +1 -1
- package/types/ui/SolidShadowRoot.d.ts +3 -0
- package/types/ui/SolidShadowRoot.d.ts.map +1 -1
- package/types/ui/createCameraManagerUi.d.ts +8 -1
- package/types/ui/createCameraManagerUi.d.ts.map +1 -1
- package/types/ui/locales/en.d.ts +3 -0
- package/types/ui/locales/en.d.ts.map +1 -1
- package/types/ui/zustandRefStore.d.ts +3 -0
- package/types/ui/zustandRefStore.d.ts.map +1 -1
- package/types/index.rollup.d.ts +0 -279
- package/types/tsdoc-metadata.json +0 -11
package/types/index.rollup.d.ts
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { SetStoreFunction } from 'solid-js/store';
|
|
2
|
-
import { StoreApi } from 'zustand/vanilla';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Represents a camera device and its active stream.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Camera {
|
|
8
|
-
#private;
|
|
9
|
-
deviceInfo: InputDeviceInfo;
|
|
10
|
-
/**
|
|
11
|
-
* Stream capabilities as reported by the stream.
|
|
12
|
-
*
|
|
13
|
-
* On iOS it's the same as `deviceCapabilities`. Firefox is only reporting
|
|
14
|
-
* rudimentary capabilities, so we can't rely on this for picking the right
|
|
15
|
-
* camera.
|
|
16
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/getCapabilities
|
|
17
|
-
*/
|
|
18
|
-
streamCapabilities?: ReturnType<MediaStreamTrack["getCapabilities"]>;
|
|
19
|
-
activeStream: MediaStream | undefined;
|
|
20
|
-
name: string;
|
|
21
|
-
facingMode: FacingMode;
|
|
22
|
-
torchSupported: boolean;
|
|
23
|
-
torchEnabled: boolean;
|
|
24
|
-
singleShotSupported: boolean;
|
|
25
|
-
original: this;
|
|
26
|
-
notify: (reason?: unknown) => void;
|
|
27
|
-
notifyStateChange?: (camera: Camera, reason?: unknown) => void;
|
|
28
|
-
constructor(deviceInfo: InputDeviceInfo);
|
|
29
|
-
startStream(resolution: VideoResolution): Promise<MediaStream>;
|
|
30
|
-
toggleTorch(): Promise<boolean>;
|
|
31
|
-
stopStream(): void;
|
|
32
|
-
getVideoTrack(): MediaStreamTrack | undefined;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export declare class CameraManager {
|
|
36
|
-
#private;
|
|
37
|
-
/**
|
|
38
|
-
* Sets the resolution of the camera stream
|
|
39
|
-
*/
|
|
40
|
-
setResolution: (resolution: VideoResolution) => Promise<void>;
|
|
41
|
-
get resolution(): "HD" | "FHD" | "UHD";
|
|
42
|
-
/**
|
|
43
|
-
* True if there is a video playing or capturing
|
|
44
|
-
* TODO: see if we can simplify this, by observing the video playback state
|
|
45
|
-
*/
|
|
46
|
-
get isActive(): boolean;
|
|
47
|
-
setFacingFilter(facingFilter: FacingMode[]): void;
|
|
48
|
-
/**
|
|
49
|
-
* Returns the cameras that are available to the user, filtered by the facing mode.
|
|
50
|
-
* If no facing mode is set, all cameras are returned.
|
|
51
|
-
*/
|
|
52
|
-
getCameras(): Camera[];
|
|
53
|
-
/**
|
|
54
|
-
* Single-time setup for a video element
|
|
55
|
-
*/
|
|
56
|
-
initVideoElement(videoElement: HTMLVideoElement): void;
|
|
57
|
-
addFrameCaptureCallback(frameCaptureCallback: FrameCaptureCallback): void;
|
|
58
|
-
removeFrameCaptureCallback(frameCaptureCallback: FrameCaptureCallback): void;
|
|
59
|
-
deinitVideoElement(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Select a camera device from available ones.
|
|
62
|
-
*/
|
|
63
|
-
selectCamera(camera: Camera): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Refreshes available devices on the system and updates the state.
|
|
66
|
-
*/
|
|
67
|
-
refreshCameraDevices(): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Starts the video playback
|
|
70
|
-
*
|
|
71
|
-
* @returns resolves when playback starts
|
|
72
|
-
*/
|
|
73
|
-
startPlayback(): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Starts playback and frame capturing.
|
|
76
|
-
*/
|
|
77
|
-
startFrameCapture(): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
* Starts a best-effort camera stream. Will pick a camera automatically if
|
|
80
|
-
* none is selected.
|
|
81
|
-
* TODO: Rename method
|
|
82
|
-
*/
|
|
83
|
-
startCameraStream({ autoplay, preferredCamera, preferredFacing, }?: {
|
|
84
|
-
autoplay?: boolean;
|
|
85
|
-
} & CameraPreference): Promise<void>;
|
|
86
|
-
/**
|
|
87
|
-
* Pauses capturing frames without pausing playback.
|
|
88
|
-
*/
|
|
89
|
-
stopFrameCapture(): void;
|
|
90
|
-
/**
|
|
91
|
-
* Stops the currently active stream. Also stops the video playback and capturing process.
|
|
92
|
-
*/
|
|
93
|
-
stopStream(): void;
|
|
94
|
-
/**
|
|
95
|
-
* Pauses the video playback. This will also stop the capturing process.
|
|
96
|
-
*/
|
|
97
|
-
pausePlayback(): void;
|
|
98
|
-
/**
|
|
99
|
-
* If true, the video and captured frames will be mirrored horizontally.
|
|
100
|
-
* TODO: apply when needed
|
|
101
|
-
*/
|
|
102
|
-
setMirrorX(mirrorX: boolean): void;
|
|
103
|
-
/**
|
|
104
|
-
* Allows the user to subscribe to state changes inside the Camera Manager.
|
|
105
|
-
* Implemented using Zustand. For usage information, see
|
|
106
|
-
* {@link https://github.com/pmndrs/zustand#using-subscribe-with-selector}
|
|
107
|
-
*/
|
|
108
|
-
subscribe: typeof cameraManagerStore.subscribe;
|
|
109
|
-
/**
|
|
110
|
-
* Gets the current internal state of the CameraManager.
|
|
111
|
-
*/
|
|
112
|
-
getState: typeof cameraManagerStore.getState;
|
|
113
|
-
/**
|
|
114
|
-
* Resets the CameraManager and stop all streams
|
|
115
|
-
*/
|
|
116
|
-
destroy(): void;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export declare type CameraManagerComponent = {
|
|
120
|
-
cameraManager: CameraManager;
|
|
121
|
-
/** Updates the localization strings */
|
|
122
|
-
updateLocalization: SetStoreFunction<CameraUiLocalizationStrings>;
|
|
123
|
-
/** Dismounts the component from the DOM and unloads the SDK */
|
|
124
|
-
dismount: () => void;
|
|
125
|
-
/** Sets a callback to be called when the component is unmounted */
|
|
126
|
-
setOnDismountCallback: (fn: () => void) => void;
|
|
127
|
-
/**
|
|
128
|
-
* The feedback layer node that can be used to append custom feedback elements
|
|
129
|
-
*/
|
|
130
|
-
feedbackLayerNode: HTMLDivElement;
|
|
131
|
-
/**
|
|
132
|
-
* The overlay layer node that can be used to append custom overlay elements
|
|
133
|
-
*/
|
|
134
|
-
overlayLayerNode: HTMLDivElement;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export declare type CameraManagerStore = {
|
|
138
|
-
/**
|
|
139
|
-
* The video element that will display the camera stream.
|
|
140
|
-
*/
|
|
141
|
-
videoElement?: HTMLVideoElement;
|
|
142
|
-
/**
|
|
143
|
-
* The list of cameras that are available to the user.
|
|
144
|
-
*/
|
|
145
|
-
cameras: Camera[];
|
|
146
|
-
/**
|
|
147
|
-
* The facing mode filter that will be used to filter the available cameras.
|
|
148
|
-
* Can be a single facing mode or an array of facing modes.
|
|
149
|
-
*/
|
|
150
|
-
facingFilter?: FacingMode[];
|
|
151
|
-
/**
|
|
152
|
-
* The currently selected camera.
|
|
153
|
-
*/
|
|
154
|
-
selectedCamera?: Camera;
|
|
155
|
-
/**
|
|
156
|
-
* Capturing / playing / idle
|
|
157
|
-
*/
|
|
158
|
-
playbackState: PlaybackState;
|
|
159
|
-
/**
|
|
160
|
-
* Indicates if the camera is currently being swapped.
|
|
161
|
-
*/
|
|
162
|
-
isSwappingCamera: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Indicates if camera list is currently being queried.
|
|
165
|
-
*/
|
|
166
|
-
isQueryingCameras: boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Indicates if the captured frames will be mirrored horizontally
|
|
169
|
-
*/
|
|
170
|
-
mirrorX: boolean;
|
|
171
|
-
/**
|
|
172
|
-
* If the Camera manager has encountered an error, this will be set to the error.
|
|
173
|
-
*/
|
|
174
|
-
errorState?: Error;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* ⚠️ DANGER AHEAD ⚠️
|
|
179
|
-
*
|
|
180
|
-
* The Zustand store. Use only if you know what you're doing.
|
|
181
|
-
*
|
|
182
|
-
* Never set the state as this will break the application logic. We do not have
|
|
183
|
-
* two-way binding. Make sure you only observe the state.
|
|
184
|
-
*
|
|
185
|
-
* Prefer using subscriptions if you require observable state.
|
|
186
|
-
*
|
|
187
|
-
* {@link https://github.com/pmndrs/zustand}
|
|
188
|
-
*/
|
|
189
|
-
export declare const cameraManagerStore: Omit<StoreApi<CameraManagerStore>, "subscribe"> & {
|
|
190
|
-
subscribe: {
|
|
191
|
-
(listener: (selectedState: CameraManagerStore, previousSelectedState: CameraManagerStore) => void): () => void;
|
|
192
|
-
<U>(selector: (state: CameraManagerStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
193
|
-
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
194
|
-
fireImmediately?: boolean;
|
|
195
|
-
} | undefined): () => void;
|
|
196
|
-
};
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export declare type CameraPreference = {
|
|
200
|
-
preferredCamera: Camera;
|
|
201
|
-
preferredFacing?: never;
|
|
202
|
-
} | {
|
|
203
|
-
preferredFacing: FacingMode;
|
|
204
|
-
preferredCamera?: never;
|
|
205
|
-
} | {
|
|
206
|
-
preferredCamera?: never;
|
|
207
|
-
preferredFacing?: never;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export declare type CameraUiLocaleRecord = typeof _default;
|
|
211
|
-
|
|
212
|
-
export declare type CameraUiLocalizationStrings = {
|
|
213
|
-
[K in keyof CameraUiLocaleRecord]: CameraUiLocaleRecord[K] | (string & {});
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export declare type CameraUiRefs = {
|
|
217
|
-
feedbackLayer: HTMLDivElement;
|
|
218
|
-
overlayLayer: HTMLDivElement;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
export declare const cameraUiRefStore: Omit<StoreApi<CameraUiRefs>, "subscribe"> & {
|
|
222
|
-
subscribe: {
|
|
223
|
-
(listener: (selectedState: CameraUiRefs, previousSelectedState: CameraUiRefs) => void): () => void;
|
|
224
|
-
<U>(selector: (state: CameraUiRefs) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
225
|
-
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
226
|
-
fireImmediately?: boolean;
|
|
227
|
-
} | undefined): () => void;
|
|
228
|
-
};
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Creates a new Camera Manager UI component.
|
|
233
|
-
*/
|
|
234
|
-
export declare function createCameraManagerUi(cameraManager: CameraManager, target?: HTMLElement): Promise<CameraManagerComponent>;
|
|
235
|
-
|
|
236
|
-
declare const _default: {
|
|
237
|
-
readonly selected_camera: "Selected camera";
|
|
238
|
-
readonly select_camera: "Select camera";
|
|
239
|
-
readonly close: "Close";
|
|
240
|
-
readonly torch: "Torch";
|
|
241
|
-
readonly mirror_camera: "Mirror camera";
|
|
242
|
-
readonly modal_title: "Scan a document";
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
export declare type FacingMode = "front" | "back" | undefined;
|
|
246
|
-
|
|
247
|
-
export declare type FrameCaptureCallback = (frame: ImageData) => void | Promise<void>;
|
|
248
|
-
|
|
249
|
-
export declare const MOUNT_POINT_ID = "camera-manager-mount-point";
|
|
250
|
-
|
|
251
|
-
export declare type PlaybackState = "idle" | "playback" | "capturing";
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Resets the store to its initial state.
|
|
255
|
-
* Stops all camera streams as a side effect.
|
|
256
|
-
*/
|
|
257
|
-
export declare const resetCameraManagerStore: () => void;
|
|
258
|
-
|
|
259
|
-
export declare type VideoResolution = keyof typeof videoResolutions;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Available video resolutions for the camera stream.
|
|
263
|
-
*/
|
|
264
|
-
export declare const videoResolutions: {
|
|
265
|
-
HD: {
|
|
266
|
-
width: number;
|
|
267
|
-
height: number;
|
|
268
|
-
};
|
|
269
|
-
FHD: {
|
|
270
|
-
width: number;
|
|
271
|
-
height: number;
|
|
272
|
-
};
|
|
273
|
-
UHD: {
|
|
274
|
-
width: number;
|
|
275
|
-
height: number;
|
|
276
|
-
};
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
export { }
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.50.0"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|