mikedmor / OctoPrint_MultiCam

Extends the Control tab of OctoPrint, allowing the ability to switch between multiple webcam feeds.
48 stars 19 forks source link

Persistent Stream to open web browser #62

Open opjose opened 1 year ago

opjose commented 1 year ago

I have the Octoprint Resource monitor plug-in installed which I use to view Ethernet activity from my Pi's running Octoprint. (Likewise this issue manifests as CPU utilization in HTOP).

I notice that when I use the classic webcam plugin to view a camera, then close the stream by moving to a different tab in Octoprint's GUI, the stream and ethernet activity stops after about a second or two.

With Multicam the stream continues to run along with the Ethernet activity as long as the target browser is open, even though I am no longer viewing the stream. Likewise the effect is cumulative, taking more bandwidth from the PI as I target each successive camera. Edge, Chrome, Opera, etc. all exhibit the same problem.

Is this an issue with Python 3 vs 2.7?

Any way to close the stream when a different camera is selected or clicked away from?

Thanks!

opjose commented 10 months ago

On a new PI 4 with a clean new installation of OctoPi with the new camera streamer the issue persists.

Disabling multicam stops the persistent streams. Something seems to be holding the connection open even when the recipient is no long available on the network.

opjose commented 10 months ago

More follow up. I have been able to determine that what is happening is that multicam (classic webcam does not do this as it has a setting to terminate the stream) will re-establish the stream to the browser or app as long as the client/browser has the OctoPi Web UI open. Even if the stream is never viewed by the user, the connection to the client persists.

I've killed all background Edge components and restarted Edge (same with Firefox, Chrome, etc.). The second the browser hits the UI the stream is re-opened. This persistence continues for up to 5-10 minutes.

The stream itself is paused when the browser is ended, but held open for reconnection for that length of time.