"Proxying images and videos through openHAB"

I’m searching for a way to include local resources from the LAN and found the following thread which seems to address this exact topic: https://groups.google.com/forum/#!topic/openhab/eag6cUqRTaU

My problem now is that I don’t know how to accomplish this. What must I include as a plugin, if necessary, and what’s the syntax to use in the sitemap?

Here is an excerpt from its JavaDoc:

  • The proxy servlet is used by image and video widgets. As its name suggests, it proxies the content, so
  • that it is possible to include resources (images/videos) from the LAN in the openHAB UI. This is
  • especially useful for webcams as you would not want to make them directly available to the internet.
  • The servlet registers as “/proxy” and expects the two parameters “sitemap” and “widgetId”. It will
  • hence provide the data of the url specified in the according widget. Note that it does NOT allow
  • general access to any servers in the LAN - only urls that are specified in a sitemap are accessible.
  • It is also possible to use credentials in a url, e.g. “http://user:pwd@localserver/image.jpg” -
  • the proxy servlet will be able to access the content and provide it to the openHAB UIs through the
  • standard openHAB authentication mechanism (if enabled).
  • This servlet also supports data streams, such as a webcam video stream etc.

Add images or other web pages/web elements to the sitemap using the Image, Video, or Webview elements. Each of these elements take a URL which points at the resource you want to load. See the sitemap wiki page.

No plugins or direct access to the proxy servlet is necessary.

Thank you @rlkoshak for answering. Ok but does this apply also to local content which I want to access externally? My guess is, from trials, no it does not.

If I point to a local resource say 192.168.0.xxx:8080/image.jpg or 192.168.0.xxx:8080/mjpegstream.php the client UI should be redirected by the OH server. This is why I found the proxy servlet mentioned in my first post suitable. Although this functionality I would actually expect to find in a fresh install of OH and maybe its there but the problem is I don’t know how to use it?

Also would it be possible to point to a local resource which is not on a server, e.g. ~/images/tempchart.png (I’m running Raspbian Jessie). Perhaps through a file:// pointer? And if possible, what permissions must be set for these files? Is it enough with read access for the openhab user?

You should be able to point at local files one if two ways.

Put a copy of the file or a symbolic link to the file in the webapps folder.

The second is to use the file:// URL format. I’m not positive this works but so long as the openHAB user has permission to read the file it should work. If you use a relative path, it must be relative to the folder openHAB was started in. I’m not sure what that folder is when it us started as a service and it is probably better practice to use full path.

1 Like

Hi @rlkoshak

I have a question regarding the proxy.

It seems like I’m unable to access my MJPEG cameras when I’m connected to my local network.

Even if I’m locally connected I get a proxy URL.

Any pointers you could give me?

Cheers.

I’m afraid not. I’ve not set this up myself yet so all my knowledge is strictly theoretical. I don’t know enough to troubleshoot problems like this.

Hey @rlkoshak,

Do you know anyone that could help on solving this issue?

Hi!

This feels somehow related to my issue in the following thread.

But I might be wrong, which happens now and then and sometimes also in the time in between. :slight_smile: