Code below read bytes from MJPEG video stream. It works perfectly on Windows 8.1 Store application, but the same code fail on Windows phone 8.1 application.
After reading 65536 bytes method "Read" not read more bytes from stream.
The same problem in On WP8.1 ONLY: cannot read more than 65536 bytes off an HTTP Stream
Someone tells about property DefaultMaximumErrorResponseLength but this property is only in WPF (not in windows store .net)
WebClient class on WP8.1 has the same problem.
(in On WP8.1 ONLY: cannot read more than 65536 bytes off an HTTP Stream says that WebClient don't have this problem, but it don't true)
Sample code:
var request = (HttpWebRequest)WebRequest.CreateHttp("http://webcam.st-malo.com/axis-cgi/mjpg/video.cgi?resolution=352x288");
request.AllowReadStreamBuffering = false;
request.BeginGetResponse(OnGetResponse, request);
private void OnGetResponse(IAsyncResult asyncResult)
{
HttpWebRequest req = (HttpWebRequest)asyncResult.AsyncState;
HttpWebResponse resp = (HttpWebResponse)req.EndGetResponse(asyncResult);
Stream s = resp.GetResponseStream();
byte[] buff = new byte[ChunkSize];
int readed;
do
{
readed = s.Read(buff, 0, ChunkSize);
}
while (readed > 0);
}