我正在使用Aforge尝试从IP摄像机获取实时流。我的问题是,由于某种原因,我的连接不断关闭。出于测试目的,我将相机直接连接到我的电脑,并通过此LAN连接到相机。Aforge从IP摄像头直播流HttpWebRequest
错误:
The underlying connection was closed: The connection was closed unexpectedly.
这里是我使用的代码:
stream.NewFrame += new NewFrameEventHandler(video_NewFrame);
stream.VideoSourceError += new VideoSourceErrorEventHandler(stream_VideoSourceError);
stream.Login = "login";
stream.Password = "pass";
stream.RequestTimeout = 10000;
stream.Source = "http://192.168.0.33/nphMotionJpeg?Resolution=320x240&Quality=Standard";
stream.Start();
我有哪里有人建议把设置在锯的app.config,我已经做了以及:
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true"/>
</settings>
</system.net>
没有编辑关闭app.config,我得到一个不同的错误。 (违反协议)
有没有人遇到过这些问题或知道如何让它工作?
注意:我也尝试获取数据没有Aforge like this但它导致了同样的错误。
尝试在VLC中打开它,看看它是否在那里工作。当我不确定我的代码是否正常工作时,我发现VLC非常适合测试MJPEG连接。 – Peter
可能与http://stackoverflow.com/questions/10823848/mjpegstream-display-stream-aforge-video-dll(虽然没有足够的细节在其他问题上肯定知道) – Peter
@Peter是的,看起来有关。没有信息虽然 – CSharpDev