TsgcHTTPServer | Stream Video

If you want to stream a video file using the server, you can use the function IndyStreamFileVideo to stream the file using chunked transfer encoding.

The function takes the following parameters:

Example: stream a video when a user goes to the document /video.mp4 and this video is in the folder c:\videos\video.mp4


procedure OnServerCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
  if ARequestInfo.Document = '/video.mp4' then
    IndyStreamFileVideo(Acontext, AResponseInfo, 'C:\videos\video.mp4')
  else
    AResponseInfo.ResponseNo := 404;
end;