WebCam example Delphi 10.2

RVMedia support and discussion (components for displaying and controlling IP cameras, webcams, video conferencing, video chats, recording audio and video files)
Post Reply
Graw
Posts: 3
Joined: Fri Mar 03, 2023 10:53 am

WebCam example Delphi 10.2

Post by Graw »

Hi,

when I try to use the webcam example I get an error when I press camera on.
It depends on the procedure btnSnapShozClick.

The z.Free is the reason for the error.
But when I remove this line the RAM is getting higher and higher with each Snapshot.
How can I solve this issue?

Thanks.

Code: Select all

procedure TfrmMain.btnSnapShotClick(Sender: TObject);
var
  Img: TBitmap;
  z : TRVImageWrapper;
begin
  if Globalz then
    Exit;
  globalz := True;

  try
    image1.Canvas.Lock;
    z := RVCamera1.GetSnapShot;

    Img := z.Bitmap.GetBitmap;
    image1.Picture.Assign(img);
  finally
    FreeAndNil(Img);
    z.Free;
    image1.Canvas.Unlock;
  end;
  Globalz := False;
end;
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: WebCam example Delphi 10.2

Post by Sergey Tkachenko »

Remove the line

Code: Select all

FreeAndNil(Img);
Graw
Posts: 3
Joined: Fri Mar 03, 2023 10:53 am

Re: WebCam example Delphi 10.2

Post by Graw »

Great,

thanks a lot.
Post Reply