Files
zoneminder/web
Nic Boet 8b9d523ffa fix: recover from zms crash by restarting stream on seek or play
When zms dies (any cause), the UI sets zmsBroke=true and subsequent
seeks/plays silently fail. Instead, restart the stream by resetting
the img src, which triggers the browser to make a new CGI request to
zms with the same connkey, spawning a fresh process.

Uses img.onload as the readiness signal rather than polling: when the
new zms delivers its first MJPEG frame, onload fires, confirming the
command socket is ready. This eliminates the race window where
CMD_SEEK could be sent before the socket exists, and removes
dependency on the poll interval (streamTimeout) for seek delivery.

Implementation:
- restartZmsStream(onReady): shared helper that clears img.src to
  kill the old connection, sets a one-shot onload handler, then sets
  the new src. onload clears zmsBroke and invokes the callback.
- streamSeek(): when zmsBroke, calls restartZmsStream with a callback
  that re-invokes streamSeek(offset) once zms is alive.
- playClicked(): when zmsBroke, calls restartZmsStream with no
  callback since zms starts in play mode by default.

Consolidates duplicate restart logic that was previously inlined in
both playClicked() and streamSeek().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 12:44:56 -06:00
..

Modern ZoneMinder Skin

This web frontend to ZoneMinder is a complete rewrite of the classic frontend, based on CakePHP.