-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
ExponentCameraManager.web.ts
67 lines (65 loc) · 1.65 KB
/
ExponentCameraManager.web.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { CameraCapturedPicture, CameraPictureOptions } from './Camera.types';
import CameraModule from './CameraModule/CameraModule';
import { canGetUserMedia } from './CameraModule/UserMediaManager';
import ExponentCamera from './ExponentCamera.web';
export default {
get name(): string {
return 'ExponentCameraManager';
},
get Type() {
return {
back: 'back',
front: 'front',
};
},
get FlashMode() {
return {
on: 'on',
off: 'off',
auto: 'auto',
torch: 'torch',
};
},
get AutoFocus() {
return {
on: 'on',
off: 'off',
auto: 'auto',
singleShot: 'singleShot',
};
},
get WhiteBalance() {
return {
auto: 'auto',
continuous: 'continuous',
manual: 'manual',
};
},
get VideoQuality() {
return {};
},
async isAvailableAsync(): Promise<boolean> {
return canGetUserMedia();
},
// TODO: Bacon: Is video possible?
// record(options): Promise
// stopRecording(): Promise<void>
async takePicture(
options: CameraPictureOptions,
camera: ExponentCamera
): Promise<CameraCapturedPicture> {
return await camera.takePicture(options);
},
async pausePreview(camera: ExponentCamera): Promise<void> {
await camera.pausePreview();
},
async resumePreview(camera: ExponentCamera): Promise<any> {
return await camera.resumePreview();
},
async getAvailableCameraTypesAsync(): Promise<string[]> {
return await CameraModule.getAvailableCameraTypesAsync();
},
async getAvailablePictureSizes(ratio: string, camera: ExponentCamera): Promise<string[]> {
return await camera.getAvailablePictureSizes(ratio);
},
};