How to load webcam stream from Octoprint API?

What is the problem?
I am making REST API octoprint client and I want to display webcam? Is possible get webcam stream from Octoprint? I am making app in ASP.NET framework.

What did you already try to solve it?

I already tried to make iframe with src="octoprint url/webcam/?action=stream", but nothing happened.

The stream url can be retrieved from the settings API endpoint, see https://docs.octoprint.org/en/master/api/settings.html#retrieve-current-settings

Not all browsers support showing mjpeg stream in an iframe.

2 Likes

Thank you, So i retreive Stream URL and I will and this URL to src of iframe, right?

No. This URL may be relative to the OctoPrint instance; you may need to make it absolute by adding the base url of the OctoPrint instance to it. Also just plonking the URL of the mjpeg webstream into an iframe may not work. If it is an mjpeg stream, using an IMG tag like OctoPrint does it is probably a better approach. But that has more to do with HTML and browsers than with OctoPrint.

2 Likes