Search code examples
androiddelphicamerafiremonkey

Firemonkey Camera Component is too slow


I'm having an issue with TCameraComponent on Android.

On the first time that I run the app, the camera is ok, but if I stop the TCameraComponent and start it again, the camera gets too slow.

Any ideas about what is going on?

CameraComponent1.Active := false;
CameraComponent1.Quality := FMX.Media.TVideoCaptureQuality.MediumQuality;
CameraComponent1.Kind := FMX.Media.TCameraKind.BackCamera;
CameraComponent1.FocusMode := FMX.Media.TFocusMode.ContinuousAutoFocus;
CameraComponent1.Active := True;
procedure TMainForm.CameraComponent1SampleBufferReady(Sender: TObject; const ATime: TMediaTime);
begin
  CameraComponent1.SampleBufferToBitmap(imgCamera.Bitmap, True);
end;

Solution

  • It seems that when I start the camera for the second time, it gets the high quality, so I just forced the component to change the quality and worked:

    CameraComponent1.Quality := FMX.Media.TVideoCaptureQuality.highQuality;
    CameraComponent1.Quality := FMX.Media.TVideoCaptureQuality.MediumQuality;