It's not an issue, that's why I'm not asking in Get Help section.
I have OctoPi (Version 1.0.0, running on Raspberry Pi 3 Model B Rev 1.2), with OctoPi (Version 1.11.5) and Classic Webcam plugin. I have also MQTT driven powering off of printer (plugins: MQTT/PSU Control/PSU Control - MQTT)
[env decription, not needed to read]
My webcam has its own light (which is fine), but its fully analog - powered from USB with only potentiometer to set brightness. I cannot switch the light off when printer is not in use, using any software solution.
So, as for now, I added simple service, which takes mqtt message (the same which turns off the printer) and cuts RPi USB ports power. When I (Octoprint or any mqtt client) sends mqtt message to power on the printer, my custom service turns on USB power and restarts webcamd.
The last part I need to do manually: reload stream in UI.
[end of description]
How to reload webcam stream in UI (periodically, on webcamd restart, or on any trigger?)?
webcamd restart is the typical approach. some people add that to their system menu so you can do it from the OctoPrint UI, and some use the event manager in OctoPrint to do it on print start event for example.
That's not enough.
I restart webcamd service shortly after powering on webcam itself. The problem is that restarting webcam works, but stream in UI is already frozen. I need to manually reload stream (left upper corner of the image) or entire site. Probably easier will be to reload. Reloading site is probably easier but very ugly and takes too much time. Reloading stream is ok, but I cannot trigger it in any way. Auto reload stream after webcamd restart will be the solution.
It's only user experience thing, and to be . Everyting works probably as designed. Maybe I'm the only one with such thing, and most people use smarter solutions
Assuming we're talking about the stream on the control tab, it should reload if you switch to a different tab and back or minimize the browser and restore.
You can use the "Cmd Exec" plugin to add this bash command that you can execute from the gui to restart the service.
systemctl restart webcamd
I'm not sure as to what privileges this plugin has by default but at worst you may have to add "sudo" in front with the appropriate options to also pass the password. (See the MAN page for sudo).