I have an Axis IP Camera setup to a Blue Iris server which is acting as a web server. Using the IP Camera Viewer in Ignition, I can connect to that camera’s view via a JPEG Stills mode, however if there is a disconnection whether from the IP Camera to server, or server to Ignition, even if for brief moment, the IP Camera Viewer in Ignition will cut out and give me the error: “Exception: Received HTTP 503: Service Unavailable”.
It will stay this way until the page is refreshed in some way. Is there a setting I’m missing or some way to automatically reconnect?
You might be able to rework the technique for restarting MJPEG streams I describe in my Image Streaming Driver module’s Usage Notes:
Wow, this works nice! Too bad there isn’t anything natively built-in, but I simply created a Project Library Script and put the ipcamera.py script in there:
from com.inductiveautomation.factorypmi.application.components import PMIIPCamViewer
parserField = PMIIPCamViewer.getDeclaredField("parser")
for c in PMIIPCamViewer.getDeclaredClasses():
if c.simpleName == 'MJPEGParser':
MJPEGParser = c
FrameProducer = MJPEGParser.superclass
stateMethod = FrameProducer.getDeclaredMethod('getState')
badStates = ['ERROR', 'CANCELED']
# Use as a binding expression (on a boolean property) in the IP Camera Viewer like so:
# objectScript("shared.ipcamera.stateCheck(binding.target)", now(1000))
def stateCheck(comp, retv=False):
parser = parserField.get(comp)
state = stateMethod.invoke(parser)
if str(state) in badStates:
print "Reconnecting %s" % comp
And then on the Show Stats boolean property on the IP Camera Viewer, I put:
I also have your Simulation Aids module, so I was able to use objectScript.