Firemonkey android stream video

  

I have a lag when receiving the image. Why ?

procedure TForm1.Timer1Timer(Sender: TObject);
var
ms :TMemoryStream;
begin
IdTCPClient2.Host:=Edit1.Text;
IdTCPClient2.Connect;
try
ms := TMemoryStream.Create;
ImageControl3.Bitmap.SaveToStream(ms);
ms.Position := 0;
IdTCPClient2.IOHandler.LargeStream := true;
IdTCPClient2.IOHandler.Write(ms,0,True);
finally
end;
IdTCPClient2.Disconnect;
ms.Free;
end;

and client receives image

procedure TForm1.IdTCPServer2Execute(AContext: TIdContext);
var
ms:TMemoryStream;
begin
ms := TMemoryStream.Create;
try
AContext.Connection.IOHandler.LargeStream:=true;
AContext.Connection.IOHandler.ReadStream(ms);
ms.Position := 0;
TThread.Synchronize(nil,
procedure
begin
Image1.Bitmap.LoadFromStream(ms);
end
);
finally
ms.Free;
ms.Clear;
end;
end;

why so long goes the picture?
What would I have to do to the image was smoother?

Comments are closed.