expo-camera
Version:
A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to t
55 lines (54 loc) • 1.84 kB
TypeScript
import { PictureOptions } from '../Camera.types';
import { CameraType, CapturedPicture, CaptureOptions, ImageType } from './CameraModule.types';
export { ImageType, CameraType, CaptureOptions };
declare type OnCameraReadyListener = () => void;
declare type OnMountErrorListener = (event: {
nativeEvent: Error;
}) => void;
export declare type WebCameraSettings = Partial<{
autoFocus: string;
flashMode: string;
whiteBalance: string;
exposureCompensation: number;
colorTemperature: number;
iso: number;
brightness: number;
contrast: number;
saturation: number;
sharpness: number;
focusDistance: number;
zoom: number;
}>;
declare class CameraModule {
private videoElement;
onCameraReady: OnCameraReadyListener;
onMountError: OnMountErrorListener;
private stream;
private settings;
private pictureSize?;
private isStartingCamera;
private cameraType;
private webCameraSettings;
get type(): CameraType;
constructor(videoElement: HTMLVideoElement);
updateWebCameraSettingsAsync(nextSettings: {
[key: string]: any;
}): Promise<boolean>;
setTypeAsync(value: CameraType): Promise<void>;
setPictureSize(value: string): void;
isTorchAvailable(): boolean;
isZoomAvailable(): boolean;
private onCapabilitiesReady;
private applyVideoConstraints;
private applyAudioConstraints;
private syncTrackCapabilities;
private setStream;
getActualCameraType(): CameraType | null;
ensureCameraIsRunningAsync(): Promise<void>;
resumePreview(): Promise<MediaStream | null>;
takePicture(config: PictureOptions): CapturedPicture;
stopAsync(): void;
getAvailablePictureSizes: (ratio: string) => Promise<string[]>;
getAvailableCameraTypesAsync: () => Promise<string[]>;
}
export default CameraModule;