UNPKG

@osobh/reactar

Version:

AR Library for React Native and Expo

43 lines (42 loc) 1.4 kB
import { EventEmitter } from 'events'; import { ViewProps } from 'react-native'; export interface MediaCaptureOptions { quality?: number; format?: 'jpg' | 'png'; result?: 'tmpfile' | 'base64' | 'data-uri'; } export interface RecordingOptions { quality?: number; maxDuration?: number; maxFileSize?: number; } export declare class MediaCapture extends EventEmitter { private isRecording; private recordingStartTime; private mediaDirectory; constructor(); private ensureMediaDirectory; /** * Captures a screenshot of the AR view * @param viewRef React ref to the view to capture * @param options Capture options * @returns Promise with the path to the saved image */ captureScreenshot(viewRef: React.RefObject<ViewProps>, options?: MediaCaptureOptions): Promise<string>; /** * Starts recording the AR session * @param viewRef React ref to the view to record * @param options Recording options */ startRecording(viewRef: React.RefObject<ViewProps>, options?: RecordingOptions): void; /** * Stops the current recording * @returns Promise with the path to the saved video */ stopRecording(): Promise<string>; /** * Cleans up old media files * @param maxAge Maximum age of files to keep (in milliseconds) */ cleanupOldFiles(maxAge: number): Promise<void>; }