Use secondary webcam URL when primary is not available

Hi, I have one webcam and I can view it's video using two URLs:

  1. Inside my local network http://[ip]:8080/video
  2. Outside my local network(via Tor) http://[hash].onion:8080/video (octoprint also running via Tor)

Both streams are visible from octoprint when I enter one into Stream URL.

I want to enter this two URLs to OctoPrint and when first URL is not reachable use the second one.
I want something like:
1.

  • I in my home, connecting via IP to OctoPrint
  • Testing URL 1, OK
  • Display stream from URL 1
  • outside my home, connecting via Tor to OctoPrint
  • Testing URL 1, ERROR
  • Testing URL 2, OK
  • Display stream from URL 2

Camera model = IP webcam app running on android phone + forwaded by PC running OctoPrint to Tor network

What did you already try to solve it? = Nothing. I can't find anything online.

Additional information about your setup = OctoPrint: 1.5.3 Python 3.8.5

Why don't you use the MultiCam plugin, using both of the URLs as "different" webcams? Thus you'd be able to get both of the stream regardless of how you're connecting to octoprint.

Otherwise you'd need a reverse proxy, most probably on your firewall, in order to use the port 80 for both octoprint and the stream.

Although going through tor doesn't seem like a good idea, your octoprint instance may still be discoverable... I hope you took proper care in securing your octoprint instance. It'd be strange to come back home seeing the printer printing something you didn't intend...

1 Like