Update code example languages
This commit is contained in:
parent
cd55596ebd
commit
e8a4e9f6b5
@ -78,7 +78,7 @@ export interface CameraDeviceProps {
|
||||
* See the [Camera Devices](https://cuvent.github.io/react-native-vision-camera/docs/devices) section in the documentation for more information about Camera Devices.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* ```tsx
|
||||
* const devices = useCameraDevices('wide-angle-camera')
|
||||
* const device = devices.back
|
||||
*
|
||||
@ -89,7 +89,6 @@ export interface CameraDeviceProps {
|
||||
* style={StyleSheet.absoluteFill}
|
||||
* />
|
||||
* )
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
device: CameraDevice;
|
||||
@ -208,7 +207,7 @@ type RefType = React.Component<CameraProps> & Readonly<NativeMethods>;
|
||||
* * {@linkcode CameraDynamicProps.isActive | isActive}: A boolean value that specifies whether the Camera should actively stream video frames or not. This can be compared to a Video component, where `isActive` specifies whether the video is paused or not. If you fully unmount the `<Camera>` component instead of using `isActive={false}`, the Camera will take a bit longer to start again.
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* ```tsx
|
||||
* function App() {
|
||||
* const devices = useCameraDevices('wide-angle-camera')
|
||||
* const device = devices.back
|
||||
@ -263,7 +262,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
|
||||
*
|
||||
* @throws {@linkcode CameraCaptureError} When any kind of error occured while capturing the photo. Use the {@linkcode CameraCaptureError.code | code} property to get the actual error
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* const photo = await camera.current.takePhoto({
|
||||
* qualityPrioritization: 'quality',
|
||||
* flash: 'on',
|
||||
@ -288,7 +287,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
|
||||
*
|
||||
* @platform Android
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* const photo = await camera.current.takeSnapshot({
|
||||
* quality: 85,
|
||||
* skipMetadata: true
|
||||
@ -318,7 +317,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
|
||||
* @throws {@linkcode CameraCaptureError} When any kind of error occured while starting the video recording. Use the {@linkcode CameraCaptureError.code | code} property to get the actual error
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* camera.current.startRecording({
|
||||
* onRecordingFinished: (video) => console.log(video),
|
||||
* onRecordingError: (error) => console.error(error),
|
||||
@ -350,7 +349,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
|
||||
* @throws {@linkcode CameraCaptureError} When any kind of error occured while stopping the video recording. Use the {@linkcode CameraCaptureError.code | code} property to get the actual error
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* await camera.current.startRecording()
|
||||
* setTimeout(async () => {
|
||||
* const video = await camera.current.stopRecording()
|
||||
@ -376,7 +375,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
|
||||
*
|
||||
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while focussing. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* await camera.current.focus({
|
||||
* x: tapEvent.x,
|
||||
* y: tapEvent.y
|
||||
@ -431,7 +430,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
|
||||
*
|
||||
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while getting all available camera devices. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* const devices = await Camera.getAvailableCameraDevices()
|
||||
* const filtered = devices.filter((d) => matchesMyExpectations(d))
|
||||
* const sorted = devices.sort(sortDevicesByAmountOfCameras)
|
||||
|
@ -73,6 +73,12 @@ export interface PhotoFile extends TemporaryFile {
|
||||
height: number;
|
||||
isRawPhoto: boolean;
|
||||
thumbnail?: Record<string, unknown>;
|
||||
/**
|
||||
* Metadata information describing the captured image.
|
||||
*
|
||||
* @see [AVCapturePhoto.metadata](https://developer.apple.com/documentation/avfoundation/avcapturephoto/2873982-metadata)
|
||||
* @see [AndroidX ExifInterface](https://developer.android.com/reference/androidx/exifinterface/media/ExifInterface)
|
||||
*/
|
||||
metadata: {
|
||||
Orientation: number;
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ const DefaultCameraDevices: CameraDevices = {
|
||||
* @returns The best matching {@linkcode CameraDevice}.
|
||||
* @throws {@linkcode CameraRuntimeError} if no device was found.
|
||||
* @example
|
||||
* ```jsx
|
||||
* ```tsx
|
||||
* const device = useCameraDevice()
|
||||
* // ...
|
||||
* return <Camera device={device} />
|
||||
@ -35,7 +35,7 @@ export function useCameraDevices(): CameraDevices;
|
||||
* @returns A {@linkcode CameraDevice} for the requested device type.
|
||||
* @throws {@linkcode CameraRuntimeError} if no device was found.
|
||||
* @example
|
||||
* ```jsx
|
||||
* ```tsx
|
||||
* const device = useCameraDevice('wide-angle-camera')
|
||||
* // ...
|
||||
* return <Camera device={device} />
|
||||
|
@ -9,7 +9,7 @@ import type { CameraDevice, CameraDeviceFormat, FrameRateRange } from 'react-nat
|
||||
* > Note that this makes the `sort()` function descending, so the first element (`[0]`) is the "best" device.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* const devices = camera.devices.sort(sortDevices)
|
||||
* const bestDevice = devices[0]
|
||||
* ```
|
||||
@ -84,7 +84,7 @@ const getFormatAspectRatioOverflow = (format: CameraDeviceFormat, size: Size): n
|
||||
* @returns A list of Camera Device Formats that match the given `viewSize`' aspect ratio _as close as possible_.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* const formats = useMemo(() => filterFormatsByAspectRatio(device.formats, CAMERA_VIEW_SIZE), [device.formats])
|
||||
* ```
|
||||
* @method
|
||||
@ -103,7 +103,7 @@ export const filterFormatsByAspectRatio = (formats: CameraDeviceFormat[], viewSi
|
||||
* Sorts Camera Device Formats by highest photo-capture resolution, descending. Use this in a `.sort` function.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* const formats = useMemo(() => device.formats.sort(sortFormatsByResolution), [device.formats])
|
||||
* const bestFormat = formats[0]
|
||||
* ```
|
||||
@ -128,7 +128,7 @@ export const sortFormatsByResolution = (left: CameraDeviceFormat, right: CameraD
|
||||
* @param {FrameRateRange} range The range to check if the given `fps` are included in
|
||||
* @param {number} fps The FPS to check if the given `range` supports.
|
||||
* @example
|
||||
* ```js
|
||||
* ```ts
|
||||
* // get all formats that support 60 FPS
|
||||
* const formatsWithHighFps = useMemo(() => device.formats.filter((f) => f.frameRateRanges.some((r) => frameRateIncluded(r, 60))), [device.formats])
|
||||
* ```
|
||||
|
Loading…
Reference in New Issue
Block a user