lecodes-cli 0.7.0 → 0.7.1

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.
@@ -1,31 +0,0 @@
1
- // Device camera → a still-photo File. Ported from worker/src/utils/CameraViewer.ts. Permission is
2
- // requested through the engine bridge's `requestCamera` (same as QRScanner); the live preview and the
3
- // capture go through `_creatorUtils.camera*`. `takePhoto()` returns a File (a host buffer handle), so
4
- // the shot can be used as a texture (`Texture2D.load(file)`), uploaded via FormData, or shared.
5
-
6
- import { File } from "./fetch"
7
-
8
- export class CameraViewer {
9
- /** Ask for camera permission and start the live preview (default: the back camera). */
10
- static async open(facingMode: "front" | "back" = "back"): Promise<void> {
11
- await new Promise<void>((res, rej) => _creator.requestCamera(res, rej))
12
- await new Promise<void>((res, rej) => _creatorUtils.cameraOpen(facingMode, res, rej))
13
- }
14
-
15
- /** Switch between the front and back camera while the preview is open. */
16
- static setFacingMode(facingMode: "front" | "back"): void {
17
- _creatorUtils.cameraSetFacingMode(facingMode)
18
- }
19
-
20
- /** Capture a still frame as an image File (host-encoded). */
21
- static takePhoto(): Promise<File> {
22
- return new Promise<File>((res, rej) => {
23
- _creatorUtils.cameraTakePhoto((bufferId, name, size) => res(new File(bufferId, name, size)), rej)
24
- })
25
- }
26
-
27
- /** Stop the preview and release the camera. */
28
- static close(): void {
29
- _creatorUtils.cameraClose()
30
- }
31
- }