Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Removed the use of the "delay" constant as it is no longer used when starting monitors on the Montage page #4163

Merged
merged 5 commits into from
Oct 3, 2024

Conversation

IgorA100
Copy link
Contributor

@IgorA100 IgorA100 commented Oct 2, 2024

Probably it broke at some point. Or maybe it never worked, but in montage.js monitors start with a delay: "monitor.start(delay);"
Essentially, the changes consist only of wrapping the function code in

    setTimeout(function() {
      ......
    }.bind(this), delay);

and adding spaces

Probably it broke at some point. Or maybe it never worked, but in montage.js monitors start with a delay:
"monitor.start(delay);"
@connortechnology
Copy link
Member

We don't want to delay loading the video, that makes for bad UI. The server has to be able to handle the load no matter what. The entire idea of delaying the streaming is flawed I think. Given the single-threaded nature of browsers, I think it doesn't have an effect anyways.

The delay was originally for the status update ajax streams, not the actual video. I switched from a self-refreshing setTimeout to an Interval. Beacuse we were getting into a state where we have multiple setTimeouts running. The Interval is far simpler.

@IgorA100
Copy link
Contributor Author

IgorA100 commented Oct 2, 2024

that makes for bad UI

In principle I agree.

I switched from a self-refreshing setTimeout to an Interval.

Yes, I saw that.
So the code in montage.js should be changed from

      // Start the fps and status updates. give a random delay so that we don't assault the server
      const delay = Math.round( (Math.random()+0.5)*statusRefreshTimeout );
      monitors[i].start(delay);

on
monitors[i].start();

And in MonitorStream.js remove the "delay" argument from function. Otherwise there will be some confusion.

@connortechnology
Copy link
Member

yes

@IgorA100 IgorA100 marked this pull request as draft October 2, 2024 16:25
@IgorA100 IgorA100 changed the title Fix: Restored monitors start with delay on Montage page Chore: Removed the use of the "delay" constant as it is no longer used when starting monitors on the Montage page Oct 2, 2024
@IgorA100 IgorA100 marked this pull request as ready for review October 2, 2024 16:42
@IgorA100
Copy link
Contributor Author

IgorA100 commented Oct 2, 2024

Done

@connortechnology connortechnology merged commit e306dcf into ZoneMinder:master Oct 3, 2024
16 of 18 checks passed
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.

2 participants