It is easy to create a video streaming server and client in your applications. The Video Stream library from WINSOFT allows you incorporate video streaming capability in your Delphi and C++Builder projects.
How to install component
1) Download the component archive here.
2) Extract files from the archive to any folder.
3) You need to copy all of the files from the folder corresponding to the Delphi version to the project folder. Please carefully check your Delphi version and folder name because DCUs are version dependent.
4) Compile and execute demo
With this library we get a set of solutions:
Video server for Windows and Android platforms
Client for Windows, Android platforms and also web client for any platform.
Information about Motion JPEG (MJPEG):
Motion JPEG is a stream of JPG images over HTTP protocol and it is commonly used for multimedia applications, often used in IP cameras. There are many ways to send images as a video to remote devices, MJPEG is the preferred one because normally it does not need any client software to be installed on the remote computer, because it is supported by most of the common web browsers.
Example
You can find full sources for FMX and VCL in the downloaded archive. Below we can review the key work for the server side:
// start TVideoServer
procedure TFormMain.FormCreate(Sender: TObject);
begin
VideoServer := TVideoServer.Create;
VideoServer.OnImageNeeded := OnImageNeeded;
end;
// Send image when need
procedure TFormMain.OnImageNeeded(const Path: string; PathParams: TStrings; var JpegImage: TByteDynArray; var SendImage: Boolean);
begin
CriticalSection.Enter;
try
if JpegStream.Size = 0 then
SendImage := False // no image available
else
if Length(JpegImage) = JpegStream.Size then
if CompareMem(JpegImage, JpegStream.Memory, JpegStream.Size) then
SendImage := False; // same image as previous
if SendImage then
begin
SetLength(JpegImage, JpegStream.Size);
Move(JpegStream.Memory^, JpegImage[0], JpegStream.Size);
Inc(ImageCount);
end;
finally
CriticalSection.Leave;
if not SendImage then
Sleep(1);
end;
end;
// set quality of JPEG images in server FMX application
procedure TFormMain.PrepareStreamImage;
var SaveParams: TBitmapCodecSaveParams;
begin
BitmapSurface.Assign(Bitmap);
CriticalSection.Enter;
try
JpegStream.Position := 0;
SaveParams.Quality := 50;
TBitmapCodecManager.SaveToStream(JpegStream, BitmapSurface, 'jpg', @SaveParams);
JpegStream.Size := JpegStream.Position;
finally
CriticalSection.Leave;
end;
end;
Below we can review the key work for the client side:
procedure TFormMain.FormCreate(Sender: TObject);
begin
VideoClient := TVideoClient.Create;
VideoClient.OnImageAvailable := ImageAvailable;
end;
procedure TFormMain.ImageAvailable(JpegImage: TByteDynArray);
var Stream: TBytesStream;
begin
Stream := TBytesStream.Create(TBytes(JpegImage));
try
TBitmapCodecManager.LoadFromStream(Stream, BitmapSurface);
finally
Stream.Free;
end;
ImageViewer.Bitmap.Assign(BitmapSurface);
// workaround for Android
if not WasRealignContent then
begin
ImageViewer.RealignContent;
WasRealignContent := True;
end;
end;
This component was developed by WINSOFT.
This component has both versions for FireMonkey and for VCL applications to Delphi / C ++ Builder 10 – 10.4.
Works with: Delphi, C ++ Builder, RAD Server, FireMonkey
Works on: Windows 32-bit, Windows 64-bit, Android, any web browser (HTTP client)
Source code included in registered version. Royalty free distribution with application without any limitation.
Related links
Download Video Stream 1.4 trial version
Like what you see? You can get the Video Stream Library and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4.1 today!
Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Free Delphi Community Edition Free C++Builder Community Edition







