Hello!
It is about dealing with web audio radios.
First the good news.
I have success with those code, Http.
Get() is ok, the pipe is working and the audio is ok:
var
FOutStream: TOutputPipeStream;
Http: TFPHTTPClient;
...
InitSSLInterface;
Http := TFPHTTPClient.Create(nil);
try
Http.AllowRedirect := True;
Http.IOTimeout := 5000;
Http.RequestHeaders.Clear;
Http.Get(URL, FOutStream);
...
With this code, a pre-init to get the info of the stream, most of time Http.
Head() works,
SL is filled and if not accepted by the stream, it fast gives a error so I can deal with it.
var
SL: TStringList;
Http: TFPHTTPClient;
...
InitSSLInterface;
Http := TFPHTTPClient.Create(nil);
SL := TStringList.Create;
try
Http.AllowRedirect := True;
Http.IOTimeout := 5000;
Http.RequestHeaders.Clear;
Http.Head(URL, SL);
...
But with this code, a other pre-init to check the info of the stream if Http.
head() has failed, Http.
Get() take lot of time to get, it is like it is sleeping.
var
TempStream := TMemoryStream;
Http: TFPHTTPClient;
...
InitSSLInterface;
Http := TFPHTTPClient.Create(nil);
TempStream := TMemoryStream.Create;
TempStream.Position := 0;
try
Http.AllowRedirect := True;
Http.IOTimeout := 5000;
Http.RequestHeaders.Clear;
Http.AddHeader('Range', 'bytes=0-2047'); // Fetch only 2 KB
Http.Get(URL, TempStream);
...
Tested with fpc 3.2.2. and 3.3.1-trunk.
How can I fix this and if you have a other idea how to get the infos of the stream it will be welcome.
Fre;D