Skip to content

fix: introduce stopped state for CMD_STOP, separating it from paused#4805

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/fix-zms-mjpeg-response-status
Draft

fix: introduce stopped state for CMD_STOP, separating it from paused#4805
Copilot wants to merge 4 commits intomasterfrom
copilot/fix-zms-mjpeg-response-status

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

  • Add stopped boolean to StreamBase in src/zm_stream.h
  • Fix MonitorStream::processCommand in src/zm_monitorstream.cpp
  • Fix EventStream::processCommand in src/zm_eventstream.cpp
  • Update web/ajax/stream.php to unpack stopped field
  • Update web/js/MonitorStream.js and EventStream.js
  • Document CMD_PLAY, CMD_STOP, and CMD_VARPLAY in MsgCommand enum

Copilot AI and others added 2 commits May 6, 2026 01:58
When CMD_STOP is sent via AJAX using ZMS MJPEG streaming, the response
was incorrectly returning paused=true instead of indicating a stopped
state (paused=false).

Changes:
- Add `stopped` boolean to StreamBase (zm_stream.h)
- MonitorStream: CMD_STOP now sets stopped=true, paused=false instead
  of paused=true; run loop skips frame sending when stopped
- EventStream: CMD_STOP sets stopped=true (was already setting
  paused=false); run loop skips frame sending when stopped
- All other play/pause commands reset stopped=false
- Both streams include stopped field in the status response struct
- stream.php unpacks the new stopped field from MSG_DATA_WATCH and
  MSG_DATA_EVENT responses
- MonitorStream.js handles stopped status in UI (shows 'Stopped' mode)
- EventStream.js tracks stopped state from server response

Fixes issue: CMD_STOP response paused=true should be paused=false

Agent-Logs-Url: https://github.com/ZoneMinder/zoneminder/sessions/ba9cb47a-a3e8-4e13-aec7-c9cd258e2a3d

Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ZoneMinder/zoneminder/sessions/ba9cb47a-a3e8-4e13-aec7-c9cd258e2a3d

Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ZMS MJPEG AJAX response for CMD_STOP command fix: introduce stopped state for CMD_STOP, separating it from paused May 6, 2026
Copilot AI requested a review from connortechnology May 6, 2026 02:12
@connortechnology
Copy link
Copy Markdown
Member

@copilot while we are here can you document what VARPLAY means vs PLAY?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 6, 2026

@copilot while we are here can you document what VARPLAY means vs PLAY?

Added inline comments to the MsgCommand enum in zm_stream.h (commit ea11498):

  • CMD_PLAY: resumes at normal speed (1×, i.e. replay_rate = ZM_RATE_BASE). Points to CMD_VARPLAY for arbitrary rates.
  • CMD_VARPLAY: resumes at a caller-specified rate packed as a network-byte-order uint16 offset by +32768. ZM_RATE_BASE (100) = 1× speed, so 32868 → 1× forward, 32668 → 1× reverse, values above 32868 fast-forward, values below 32668 fast-reverse.
  • CMD_STOP (already added by this PR): halts all streaming — no keepalives, distinct from CMD_PAUSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using "ZMS MJPEG" and sending the "CMD_STOP" command via AJAX, the received response is "respObj.status.paused = true"

2 participants