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?