Getting empty images from recorder server when requesting JPEGGetLive.

Hi, I have a SreamingConnector class that wraps the RecorderCommandService and LoginInfo from a successful connection to a login server.

Here is the constructor:

public StreamingConnector(MyCameraInfo cinfo, LoginInfo loginInfo, RecorderCommandService service)
{
	LoginInfo = loginInfo;
	CameraInfo = cinfo;
	Service = service;
}

Here are the Live methods:

public void LiveFeed()
{
	lock (livelock)
	{
		if (_imageThread != null 
		    && _imageThread.IsAlive)
		{
			return;
		}
 
		_imageThread = new Thread(DoLive);
		_imageThread.Start();
	}
}
	private void DoLive()
	{
	  _live = true;
	  while (_live)
	  {
	    try
	    {
	      if (OnImageReceivedMethod != null 
	      && OnImageReceivedMethod
	      .GetInvocationList().Length > 0)
	      { 
	        JPEGData image = 
                      Service.JPEGGetLive(
                      LoginInfo.Token, 
		      CameraInfo.DeviceId, 
		      CameraInfo.Width, 
		      CameraInfo.Height
                );
	        ImageInfo imageInfo = new ImageInfo();
	        imageInfo.Data = image.Data;
	        imageInfo.Length = image.Data.Length;
	        imageInfo.Current = image.Time.
                               ToString();
	        imageInfo.Height = CameraInfo.Height;
	        imageInfo.Width = CameraInfo.Width;
	        new Thread(() => OnImageReceivedMethod?
	          .Invoke(imageInfo)).Start();
	      }
	      else
	      {
	        _live = false;
	      }
	    }
	    catch (Exception ex)
	    {
	      Logger.Error(ex);
	      Logger.Error(ex.StackTrace);
	      if (OnServiceDisconnectedMethod != null)
	      {
	        string emsg = 
                        "Error retreaving Image.";
	        OnServiceDisconnectedMethod?
                    .Invoke(emsg);
	        OnLiveConnectionStopped(emsg);
	      }
	      _live = false;
	    }
	  }
	  OnServiceDisconnectedMethod?
                .Invoke("SUCCESS");
	  OnLiveConnectionStopped("SUCCESS");
	}

LiveFeed() executes DoLive in a thread. When DoLive ends, it executes OnLiveConnectionStopped to clean up the thread.

The image is forwarded to a WebSocket client via the OnImageReceivedMethod delegate.

My problem is, I am getting no image data in the streaming images.

They stream… but with nothing in them. And I am getting no exceptions.

This code works fine on our office server, but is not working on our client’s Federated architecture.

I am hoping the cameras are simply disabled or somehow disconnected. I will find this out tomorrow, Friday. If these cameras are working, then are other things I can check?

Is there another way I can view live streaming, without a MobileServer?

My first idea from your description. If you have a one-server test system the recording server will have the same url as the management server where you log in. In all other system setups there will most often be many recording servers each with their own address. So a guess is that you do not correctly address the recording server(s).

This will be the case even if there is only one site, if you have a federated setup you will also have to deal with many management servers and have to log in on each of them.

That’s a great thought, Bo. Thank you.

On our server the Recorder Name is just the unqualified hostname and our license doesn’t support renaming it.

The RecorderInfo class has a HostName which is fully qualified on our server, but I am unsure about theirs. However, the Name field of the RecorderInfo class on their server is fully qualified.

I decided, instead, to user the WebServerUri from the RecorderInfo class.

My thinking is, they can change the port of this recorder so I shouldn’t hard code or use a variable. This Uri should always be correct.

I’ll let you know how it went, after they redeploy tomorrow.

Thanks again. You are like that guy over the cube wall whose been there already as I tread this new system.

Also, when you say login on each of them, do you mean login with Windows NetworkCredentials? I understood Federated to mean, If I login to the parent login server, I can use the login TOKEN to connect to the other servers.

So the first server would be:

LoginInfo logInfo = Service.Login(clientGuid, “”);

Each subsequential would be:

Service.Login(NewclientGuid, logInfo.Token);

Is this not correct?

In a federated setup you have multiple sites, multiple management servers. For each management server you will need to do a login, and then use the token from that management server towards the recording servers belonging to it.

So while you can use the token from a management server towards all of its recording servers, you cannot use the same token if the recording server belongs to another management server.

OK, Good to know. Thank you Bo!