It’s a lot of code, but basically i’m just looping through a set of cameras and calling the below method. It always works for the first 2, but times out after. I’ve played with the timeout limit from very short to very long but no success. And it doesn’t matter which cameras they are. For example if I try camera A,B,C,D, then A and B will always work, however if I jumble the order to D,C,B,A then only D and C will work.
Code is below. Do you have any sample demo of viewing multiple live streams at once?
public void PlayMilestoneStream(PictureBox pictureBoxVideo, Camera camera)
{
try
{
var videoParams = new VideoParams()
{
CameraId = camera.ItemID,
DestWidth = splitMain.Panel2.Width,
DestHeight = splitMain.Panel2.Height,
CompressionLvl = 83,
FPS = 30,
MethodType = StreamParamsHelper.MethodType.Push,
SignalType = StreamParamsHelper.SignalType.Live,
StreamType = StreamParamsHelper.StreamType.Transcoded,
};
Connection connection = MilestoneConnections[camera.NVRIndex];
var response = connection.Video.RequestStream(videoParams, null, TimeSpan.FromSeconds(3));
if (response.ErrorCode != ErrorCodes.Ok)
{
string someText2 = “Error requesting stream from camera (” + response.ErrorCode.ToString() + ") - Camera Name: " + camera.FullName + ", ItemID: " + camera.ItemID + ", CurrentVideoID: " + camera.CurrentVideoID;
return;
}
Guid ab = camera.ItemID;
camera.LiveVideo = connection.VideoFactory.CreateLiveVideo(new RequestStreamResponseLive(response));
camera.CurrentVideoID = camera.LiveVideo.VideoID;
camera.LiveVideo.NewFrame = OnNewFrame;
camera.LiveVideo.Start();
}
catch (Exception ex)
{
int a = 0;
}
}