.NET SDK Mobile Integration - Multiple Stream

Using the MobileSamples solution in .NET, with LiveSample, I’ve modified the code so that instead of one video feed there’s 4. It all works well but after the second video it fails trying to get a 3rd stream.

The line below has the error code to be “CommandTimedOut”

var response = connection.Video.RequestStream(videoParams, null, TimeSpan.FromSeconds(30));

The fact that I’ve got 2 streams to run concurrently means the SDK can stream more than one camera at the same time, however I don’t know why it won’t do any more than 2. Is this a limitation of the SDK, or is there something I can set in the code? Or maybe something that needs to be configured on the milestone management software?

Hi

We do not except such behavior, so could you please provide some code what modifications you have made . You may also look into the logs of the Mobile Server if there is any info why it fails.

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;

}

}

Hi,

Connection connection = MilestoneConnections[camera.NVRIndex];

Do you use multiple connections - per each camera a new one - this is not needed you can use one connection per all.

Do you set Connection.RunHeartBeat = true; for each one ?

Otherwise please provide Mobile Server logs.

I can succesfully open 4 streams .

The code was built in a way for a use case in which there could be multiple sites with their own cameras. In my testing I’m only using the one connection, as in MilestoneConnections would have a count of 1

I do not set Connection.RunHeartBeat = true, however even after trying it I still get the error. Unless there’s a specific time when it needs to be set such as before/after Connection.Connect method

Where abouts would I find the Mobile Server Logs?

Hi Svetlana, any update since my last reply?

The code was built in a way for a use case in which there could be multiple sites with their own cameras. In my testing I’m only using the one connection, as in MilestoneConnections would have a count of 1

I do not set Connection.RunHeartBeat = true, however even after trying it I still get the error. Unless there’s a specific time when it needs to be set such as before/after Connection.Connect method

Where abouts would I find the Mobile Server Logs?

@Joseph Twal

Demo with 4 simultaneous live streams provided by mail. Code and UI is quite poor, but that’s all I could do in a hurry.

Concurrent streams work with no problem on my side.

Let me know if that’s what you needed.

Br,

Nikolay