Skip to content

拍照保存延迟问题 #47

@xuxiaoqian1

Description

@xuxiaoqian1

描述 / Description

问题:拍照保存延迟平均在6s以上。
期望:保持在2s以内。
问题复现demo:

 
import { Button, Text, View } from 'react-native';
import React, { useRef } from 'react';
import { Camera, useCameraDevice, useCameraFormat, useCameraPermission } from 'react-native-vision-camera';

export default function VisionCameraDemo() {
  const device = useCameraDevice('back');
  const format = useCameraFormat(device, [
      { videoResolution: { width: 3048, height: 2160 } },
      { fps: 60 },
  ]);
  const { hasPermission, requestPermission } = useCameraPermission();
  const camera = useRef<Camera>(null);

  if (!device) {
      return <Text>No Devices</Text>;
  }

  if (!hasPermission) {
      requestPermission();
  }

  const onTakePhoto = async () => {
      const photoFile = await camera.current?.takePhoto();
      console.log("takePhoto photoFile:" + photoFile);
  };

  return (
      <View style={{ width: "100%", height: "80%", display: "flex" }}>
          <Camera
              style={{ flex: 1 }}
              ref={camera}
              device={device}
              format={format}
              isActive={true}
              preview={true}
              photo={true}
          />
          <View style={{ width: '100%', position: 'absolute', bottom: 0, left: 0, zIndex: 999 }}>
              <Button title="拍照" onPress={onTakePhoto}></Button>
          </View>
      </View>
  );
}

复现步骤 / Steps to reproduce

No response

库版本 / Library version

4.0.1-0.0.12

React Native OpenHarmony version

0.72.29

构建类型 / Build type

Debug app & dev bundle

设备 / Device

Real device

设备版本 / Device model

Mate 60 pro(NEXT.0.0.65)

已悉知 / Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions