Duet3D / DuetWebControl

A completely new web interface for the Duet electronics
GNU General Public License v3.0
408 stars 230 forks source link

[FeatureRequest]: Webcam: stop streaming if not visible #399

Closed NikAWing closed 2 years ago

NikAWing commented 2 years ago

Is your feature request related to a problem? Please describe.

It looks like the webcam streams even if it is not visible in the webcam viewer of DWC I see a constant downstream the moment I open the webcam viewer in DWC and it won't stop if I go back to dashboard, status etc.

Describe the solution you propose.

I think it would save some resources if it would stop streaming while being invisible :)

Describe alternatives you've considered

none

Provide any additional context or information.

No response

chrishamm commented 2 years ago

Good idea, this will be implemented in the next version.

chrishamm commented 2 years ago

Now implemented in 3.4-rc1.

NikAWing commented 2 years ago

I think there's a bug in rc1. If I go to webcam view, I see a downstream of 400kB/s I go to status (or anywhere else) and back to webcam view and see a downstream of 800kB/s I did it 2 times more and was at 1600+ kB/s Looks like a webcam connection is opened everytime without closing the already existing stream when leaving the webcam view page.

chrishamm commented 2 years ago

What kind of webcam are you using? When I go away from the Webcam page, I can see the refresh attempts stopping immediately.

NikAWing commented 2 years ago

Hello Christian,

I think (just switched off the printer lol) it's MJPG-Streamer with a logitec webcam. Before the upgrade to RC1 it didn't stop streaming, but you could open page without any visible increase in bandwidth. Now it looks like it opens a new stream without closing the old one(s).

chrishamm commented 2 years ago

The corresponding img tag is effectively destroyed when you go to another page, so I don't see why the stream would remain active. What browser are you using and would it be possible to use another one for testing purposes?

NikAWing commented 2 years ago

I notice it when opening the webcam page, it takes a moment to init the stream I only have (newest) firefox, I might be able to test it on tablet with chrome, but I can not do that today though I will also try to let FF "forget" the website data and see if that changes something (not sure if that even is related to the problem I have) I'll comment again as soon as I have results :)

NikAWing commented 2 years ago

Alright, just made some tests. PC, Firefox and "forget website", connecting to printer, webcam page, dashboard page (which BTW seems to always take several secons to load), back to webcam page and twice the bandwidth used then to status page and back to webcam page, thrice the bandwidth used

tried it on smartphone with firefox browser, same behavior. and also the same with chrome browser on smartphone

chrishamm commented 2 years ago

I'll attempt to fix this in the upcoming 3.4-rc2.

chrishamm commented 2 years ago

Should be fixed now in 3.4-rc2.