Commit Graph

346 Commits

Author SHA1 Message Date
Isaac Connor
692b77b4da fix: guard against empty auth_relay producing double && in zms URLs
When auth is disabled or auth_relay is empty, appending '&'+auth_relay
produces a trailing '&' which results in double '&&' when the next
parameter is appended (e.g. ?monitor=2&&scale=41&mode=single).

Guard all 4 places in MonitorStream.js where auth_relay is concatenated
into URLs, consistent with EventStream.js which already guards this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 12:27:56 -04:00
IgorA100
1fc68a3e84 If the system volume was set to 0, change the state of the "Mute" icon in the volume slider (MonitorStream.js) 2026-03-18 13:32:01 +03:00
Isaac Connor
5561829450 fix: include username in auth relay and fix stale auth in stream restart
- Add user= parameter to get_auth_relay() so zms can use the indexed
  Username column instead of iterating all users to validate the hash
- Apply the same fix to Event.php getStreamSrc() and getThumbnailSrc()
- Tighten Monitor.php from isset() to !empty() for consistency
- In MonitorStream.js start(), check if the auth hash in the img src
  matches the current auth_hash before resuming via CMD_PLAY. If stale,
  fall through to rebuild the URL with fresh auth_relay. This prevents
  long-running montage pages from spawning zms with expired credentials.
- Downgrade zms auth failure from Error to Warning

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 10:01:47 -04:00
IgorA100
f536252a85 Set "pointer-events: none" for "imgInfoBlock" and "infoBlock" to disable pointer events for them (MonitorStream.js) 2026-03-14 17:16:39 +03:00
IgorA100
94b1ead0f4 When stopping a stream, execute writeTextInfoBlock after checking the existence of the stream (MonitorStream.js) 2026-03-14 16:07:50 +03:00
IgorA100
d43dd30155 Normalizing text before assigning it to a DOM element
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-14 15:45:01 +03:00
IgorA100
dcd3ef06ad Instead of explicitly specifying the text size, we use a call to the new function "setTextSizeOnInfoBlock" (MonitorStream.js)
This will allow us to correctly specify the class for the block.
2026-03-13 11:43:42 +03:00
IgorA100
33783300bd Fix: Eslint (MonitorStream.js) 2026-03-12 23:58:27 +03:00
IgorA100
d00f56d036 When a stream is loaded, paused, or stopped, display a corresponding caption in the center of the stream player. (MonitorStream.js)
Additionally, when loading or stopping a stream using Go2RTC, RTSP2Web, or Janus, display a static image generated at that moment.
2026-03-12 23:41:32 +03:00
IgorA100
7d833bd8bb Fix Eslint (MonitorStream.js) 2026-03-11 18:57:16 +03:00
IgorA100
1478594780 Code optimization (MonitorStream.js)
- getAudioStream has been renamed to getAVStream
- Clear this.handlerEventListener['volumechange'] when the stream is stopped
- Check volumeSlider.noUiSlider after assigning the listener
- This.handlerEventListenerStream does not require an argument (stream), but if we have already received a stream, we will pass it as an argument to avoid searching for the stream again.
2026-03-11 18:53:05 +03:00
IgorA100
23fd92ef3a Update web/js/MonitorStream.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-11 18:08:59 +03:00
IgorA100
ced61c1c7d Update MonitorStream.js 2026-03-10 17:59:45 +03:00
IgorA100
2bf9d415da The listener assignment has been moved above the noUiSlider check (MonitorStream.js).
I also removed the unnecessary code for checking the presence of audioStream.
2026-03-10 10:57:01 +03:00
IgorA100
aa7aa38d70 Using "manageEventListener" for the 'volumechange' event (MonitorStream.js) 2026-03-10 01:07:15 +03:00
IgorA100
d051848fbf Fix: Eslint (MonitorStream.js) 2026-03-09 23:36:54 +03:00
IgorA100
d797a1e100 We use manageEventListener to set and remove listeners for the stream's "play" event. (MonitorStream.js)
We'll also now receive tracks from the stream when playback begins.
2026-03-09 23:23:29 +03:00
Isaac Connor
cb57de7d61 fix: sync analysis button state with zms-reported analysis image status
When zms reports it is not sending analysis frames (e.g. monitor is not
analysing), update the analyse button appearance and MonitorStream's
analyse_frames state to reflect reality. Register the analyseBtn via
setButton in both watch and zone views so MonitorStream can update it.
View-level toggle handlers now read the current state from MonitorStream
before toggling to stay in sync with server-reported changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:46:25 -04:00
Isaac Connor
4df2bf4f0b feat: add analysis_image field to stream status for client-side verification
Add a boolean analysis_image field to the CMD_QUERY status response that
reports whether zms is actually sending analysis images (with motion zone
overlays) or regular capture images. This lets MonitorStream.js detect
when the stream state is out of sync with what the client requested and
re-send the CMD_ANALYZE_ON/OFF command to correct it.

The field is true only when frame_type is FRAME_ANALYSIS, shared memory
is valid, and the monitor has analysis enabled — matching the same
condition used to select the image in the streaming loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 15:44:49 -04:00
Isaac Connor
b3114c2f60 Merge pull request #4682 from IgorA100/patch-723160
Fix: Remove unused listeners when stopping a stream.
2026-03-08 10:40:20 -04:00
IgorA100
e77993e35f Instead of "useCapture" we use the extended version "options" MonitorStream.js 2026-03-08 12:38:45 +03:00
Isaac Connor
dbd52087d3 Update web/js/MonitorStream.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-07 17:35:02 -05:00
Anatoliy Korovkin
84465bd28d Use const for Janus onremotetrack locals
Replace let with const for stream/audioElement since they are not reassigned.
2026-03-06 10:09:59 +01:00
IgorA100
15cb090d95 Instead of handlerEventListener, we use this.handlerEventListener (MonitorStream.js).
We won't use the "this.killStreamListenerId" variable recommended by Copilot, but will instead use the this.handlerEventListener array, as we may have other listeners in the future.
Using an array will eliminate the need to declare additional constants.
2026-03-06 10:46:09 +03:00
Anatoliy Korovkin
479b58c023 Fix ReferenceError in Janus onremotetrack handler
When using Janus live streaming, MonitorStream.js assigns to undeclared variables (stream, audioElement) inside onremotetrack(). In strict mode this causes "ReferenceError: stream is not defined" and breaks playback. This change declares stream/audioElement with let, fixing Janus live video/audio playback.
2026-03-06 00:17:34 +01:00
IgorA100
2f9839b20b To assign the 'beforeunload' listener and remove the listener, we now use the ManageEventListener class (MonitorStream.js) 2026-03-05 19:01:25 +03:00
Isaac Connor
a13d618946 Merge pull request #4643 from IgorA100/patch-412820
Fix: More correct processing of the stream after hiding and then displaying the Watch page
2026-03-05 08:32:23 -05:00
IgorA100
436b220e30 Use play() on the VIDEO tag, but not from MonitorStream to avoid recursion (MonitorStream.js) 2026-03-05 10:05:42 +03:00
IgorA100
da47c57929 Merge branch 'master' into patch-900470 2026-03-05 09:50:50 +03:00
Isaac Connor
efe6bf341b Update web/js/MonitorStream.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-04 20:51:02 -05:00
IgorA100
c50f795e61 Removed "waitUntil" since it's now in skin.js (MonitorStream.js) 2026-03-04 14:41:52 +03:00
IgorA100
cfafd6ca6a Update MonitorStream.js 2026-03-02 10:07:21 +03:00
IgorA100
4b2506d152 Fix: Eslint (MonitorStream.js) 2026-03-01 19:10:24 +03:00
IgorA100
a3be887919 Merge branch 'master' into patch-900470 2026-03-01 19:06:32 +03:00
IgorA100
3d02585634 Fix: If an RTSP2Web type RTC error occurs, restart the stream instead of killing it (MonitorStream.js) 2026-03-01 00:31:08 +03:00
IgorA100
526ef187b1 Update MonitorStream.js 2026-03-01 00:13:44 +03:00
IgorA100
dde7925115 Fix: Use lowercase when searching for the current go2rtc mode (MonitorStream.js) 2026-02-28 22:49:22 +03:00
Isaac Connor
07345d095a Merge pull request #4638 from IgorA100/patch-129096
Optimizing "VolumeSlider" (MonitorStream.js)
2026-02-28 10:39:03 -05:00
IgorA100
6d9fe76464 To determine the go2rtc stream type, use "currentMode" instead of "mode" (MonitorStream.js) 2026-02-27 16:35:43 +03:00
IgorA100
9e115a243d Do not adjust MSE delay if streamStartTime is undefined. (MonitorStream.js) 2026-02-27 12:14:23 +03:00
IgorA100
f23098fa6a Fix: Check the "players" variable (MonitorStream.js).
After adding the "players" variable, the "players is not defined" issue appears on various pages.

There's currently an error on the Zones page.
Yes, ideally, the variable should be added in *.js.php files on various pages.
The absence of the variable has no significant impact, other than incomplete display of information.
The current error disrupts all JavaScript.
This PR prevents the disruption of all JavaScript code on the page.
2026-02-26 22:49:20 +03:00
IgorA100
598ed8ada7 Hide the #delay block when the stream starts (MonitorStream.js) 2026-02-24 14:37:27 +03:00
IgorA100
72f0bee2d7 Moved the getTracksFromStream functions to sfin.js, as this will allow you to retrieve tracks from recorded events. (MonitorStream.js)
Also: If any error occurs during execution of "appendMseBuffer" (not just 'QuotaExceededError'), restart the thread
2026-02-23 18:16:56 -05:00
Isaac Connor
615055e496 fix: default analysis overlay to off in zms streams
MonitorStream.js initialized analyse_frames = true, causing zone
overlays to always appear on stream start regardless of view settings.
Change default to false so watch view starts clean. The zone editor
view already explicitly enables analysis after monitor creation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:16:55 -05:00
IgorA100
6da1427507 Fix Eslint (MonitorStream.js) 2026-02-23 23:45:33 +03:00
IgorA100
ab620ab28e Fix space (MonitorStream.js) 2026-02-23 23:41:02 +03:00
IgorA100
67341bc552 Feat: Moved some code to the "manageMSESocket" function (MonitorStream.js)
This will now allow you to manage MSE mode for Go2RTC, not just RTSP2Web.
2026-02-23 23:09:51 +03:00
IgorA100
48801216fe Added "zmsState" and its processing (MonitorStream.js) 2026-02-23 13:58:48 +03:00
IgorA100
9cd7de74bf Code optimization (MonitorStream.js) 2026-02-21 12:12:03 +03:00
IgorA100
25ed572167 Changed the destroy method for VolumeSlider (MonitorStream.js) 2026-02-21 00:29:55 +03:00