Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIWVideo
#1
Hi,

I have tried the new TIWVideo component in IW15 and got it working. I am wondering if it can support a live video stream (either rtsp or multi-part jpeg)?

Thanks,
Tim
Reply
#2
IWVideo running with any IntraWeb application does support video streaming from files and or streams. However some modifications will probably be needed.

I believe you will need a TStream descendant which will receive your input video stream and pass it to IW core... Have you considered this?
Reply
#3
(07-22-2023, 01:39 AM)Alexandre Machado Wrote: IWVideo running with any IntraWeb application does support video streaming from files and or streams. However some modifications will probably be needed.

I believe you will need a TStream descendant which will receive your input video stream and pass it to IW core... Have you considered this?

Thanks Alexandre. I have some idea how to do this but could you help me get started? How would I pass the stream to IW Core?
Reply
#4
Yes, sure. That should be interesting... I'll do some experimentation and let you know.

Cheers,
Reply
#5
That would be great thanks Alexandre.
Reply
#6
I've made some progress on this. I've been working with a TIWImage component. I've got the jpeg data from the live stream and I am using it to update the image (IWImage.Picture.LoadFromStream...).

I'm not sure of the best way to redraw the image. I've tried a few techniques. The most successful one I have found involves redrawing the image in an aynchronous timer event and then calling RefreshAsyncRender. This works but suffers from bad flickering.

Appreciate any advice.

Thanks,
Tim
Reply
#7
Anyone got any suggestions as to how I can reload a TIWImage asynchronously without it flickering?
Reply
#8
I think I would be using the html5 canvas or TIWCanvas for something like that.  The canvas should draw realtime without flicker.  The demo below uses the video tag but I'm also drawing to an html5 canvas also.  Near the end of the video you'll see the effect.  Even the TIWVideo component may already do want you want, you'll just have to serve it chunks of data it understands.

IOS Safari camera access (atozed.com)
Reply
#9
(08-01-2023, 08:06 PM)MJS@mjs.us Wrote: I think I would be using the html5 canvas or TIWCanvas for something like that.  The canvas should draw realtime without flicker.  The demo below uses the video tag but I'm also drawing to an html5 canvas also.  Near the end of the video you'll see the effect.  Even the TIWVideo component may already do want you want, you'll just have to serve it chunks of data it understands.

IOS Safari camera access (atozed.com)

Thanks for the tips. I've tried using a TIWCanvas but I can't get it to display anything. Can you help me get started? I've got a form with a button and a canvas on it and I've tried this:

Code:
procedure TIWForm1.Btn1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
  IWCanvas1.LineWidth := 10;
  IWCanvas1.PenColor := clWebBLUE;
  IWCanvas1.MoveTo(0, 0);
  IWCanvas1.LineTo(200, 200);
  IWCanvas1.RefreshAsyncRender;
end;

If I can get this to work I will move on to trying to draw a jpg image on it.

Thanks again!
Reply
#10
(08-02-2023, 08:57 PM)troberts Wrote:
(08-01-2023, 08:06 PM)MJS@mjs.us Wrote: I think I would be using the html5 canvas or TIWCanvas for something like that.  The canvas should draw realtime without flicker.  The demo below uses the video tag but I'm also drawing to an html5 canvas also.  Near the end of the video you'll see the effect.  Even the TIWVideo component may already do want you want, you'll just have to serve it chunks of data it understands.

IOS Safari camera access (atozed.com)

Thanks for the tips. I've tried using a TIWCanvas but I can't get it to display anything. Can you help me get started? I've got a form with a button and a canvas on it and I've tried this:

Code:
procedure TIWForm1.Btn1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
  IWCanvas1.LineWidth := 10;
  IWCanvas1.PenColor := clWebBLUE;
  IWCanvas1.MoveTo(0, 0);
  IWCanvas1.LineTo(200, 200);
  IWCanvas1.RefreshAsyncRender;
end;

If I can get this to work I will move on to trying to draw a jpg image on it.

Thanks again!

A bit of progress. I can draw a box on the canvas:


Code:
  IWCanvas1.BrushColor := clWebBROWN;
  IWCanvas1.FillRect(0, 0, 100, 100);

Then I tried to load an image into the canvas:

Code:
procedure TIWForm1.Btn1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
  IWCanvas1.UploadPngImage;
end;

In the ImageUploaded event I loaded an image from a file:

Code:
procedure TIWForm1.IWCanvas1PngImageUploaded(Sender: TObject; aImage: TPngImage);
begin
  aImage.LoadFromFile('Tick.png');
end;

But the image is not displayed. What is the correct way to do this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)