import Vnmf from '../../index' declare module '../../index' { /** * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html */ interface CameraContext { /** Fetch Camera Real-time frame data * * **** * * Notes: Use the interface at same time [camera](/docs/components/media/camera) Assigned in Component Properties frame-size。 * @supported weapp, tt * @example * ```tsx * const context = wx.createCameraContext() * const listener = context.onCameraFrame((frame) => { * console.log(frame.data instanceof ArrayBuffer, frame.width, frame.height) * }) * listener.start() * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.onCameraFrame.html */ onCameraFrame( /** Reciprocal function */ callback: CameraContext.OnCameraFrameCallback, ): CameraFrameListener /** Set Scale Level * @supported weapp, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.setZoom.html */ setZoom(option: CameraContext.SetZoomOption): void /** Start video. * @supported weapp, rn, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html */ startRecord(option: CameraContext.StartRecordOption): void /** End of Video * @supported weapp, rn, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html */ stopRecord(option?: CameraContext.StopRecordOption): void /** Take a picture. * @supported weapp, rn, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html */ takePhoto(option: CameraContext.TakePhotoOption): void } namespace CameraContext { interface SetZoomOption { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: StartRecordSuccessCallbackResult) => void /** Scale Level,Scope[1, maxZoom]。zoom Preferable decimals,Precision to decimal one.。maxZoom Yes. bindinitdone Get in return value。 */ zoom: number } interface StartRecordSuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Scale level of actual settings。Due to system constraints,Some models may not be able to set the specified value,Change to the nearest setup value。 */ zoom: number } interface StartRecordOption { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void /** More than30sor page `onHide` We'll end the video. */ timeoutCallback?: StartRecordTimeoutCallback } /** More than30sor page `onHide` We'll end the video. */ type StartRecordTimeoutCallback = ( result: StartRecordTimeoutCallbackResult, ) => void interface StartRecordTimeoutCallbackResult { /** Temporary path to cover photo files */ tempThumbPath: string /** Temporary path for video files */ tempVideoPath: string } interface StopRecordOption { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (result: StopRecordSuccessCallbackResult) => void } interface StopRecordSuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Temporary path to cover photo files */ tempThumbPath: string /** Temporary path for video files */ tempVideoPath: string /** Call Results */ errMsg: string } interface TakePhotoOption { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Image mass */ quality?: keyof Quality /** Interface calls a successful echo function */ success?: (result: TakePhotoSuccessCallbackResult) => void } interface TakePhotoSuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Temporary path for photo files,Andre is...jpgPicture Format,iosYes.png */ tempImagePath: string /** Call Results */ errMsg: string } /** Reciprocal function */ type OnCameraFrameCallback = (result: OnCameraFrameCallbackResult) => void interface OnCameraFrameCallbackResult { /** Image Pixel Point Data,One-dimensional array,Every four is a pixel point. rgba */ data: ArrayBuffer /** Height of the image data rectangle */ height: number /** Width of the image data rectangle */ width: number } interface Quality { /** Quality */ high /** Normal Quality */ normal /** Low Quality */ low } } /** CameraContext.onCameraFrame() Back Listener。 * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.html */ interface CameraFrameListener { /** Start listening to frame data. * @supported weapp, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.start.html */ start(option?: CameraFrameListener.StartOption): void /** Stop listening to frame data * @supported weapp, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.stop.html */ stop(option?: CameraFrameListener.StopOption): void } namespace CameraFrameListener { interface StartOption { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } interface StopOption { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } } interface VnmfStatic { /** Create camera Context CameraContext Object。 * @supported weapp, rn, tt * @example * ```tsx * const cameraContext = Vnmf.createCameraContext() * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/wx.createCameraContext.html */ createCameraContext(): CameraContext } }