I managed to get the ipcamera binding up and running in my openhab installation. The urls for snaphots and mjpeg stream are working, if I’m using them in my browser window directly. In my case that is
http://192.168.50.10:8081/ipcamera.jpg for snapshots and
http://192.168.50.10:8081/ipcamera.mjpeg for mjpeg stream.
If I try to use this URLs in an oh-image component, neither of the urls are loading and displaying an image.
Here is my oh-image component with a working testcode:
- component: f7-block
- component: oh-image
This is the result:
But using one of the ipcamera URLs like in the following example doesn’t work. Screenshot of the broken image below:
- component: f7-block
- component: oh-image
Are there any ideas where to investigate or how to solve the problem?
Put the ipcamera binding into TRACE mode and that will confirm the binding gets the request. There are a lot of changes in the binding including a breaking change so upgrade and test the newer serving method.
thank you for the advice. I put the binding into TRACE mode and here are the results:
If I open a page with the oh-image component nothing happens. But if I click on the “broken Image” with the right mouse trigger and choose “open picture in new tab”, the camera stream is shown in the new tab. In the trace log I can see the following event
[pcamera.internal.StreamServerHandler] - Stream Server recieved request GET:/ipcamera.mjpeg
Seems, that loading the oh-image in a normal page doesn’t trigger the event and no image is created. This is maybe a browser specific behavior. Right now I’m using Chrome and Win10. Accessing the page via my android device shows the stream in the oh-component. The openhab version is 3.1.0 and it’s running on raspbian.
Is there any possibility to trigger the StreamServer? What do you mean by “upgrade and test the newer serving method”?
See here for details and you can wait a week and 3.2 Stable may be out, use a milestone now, or upgrade to the newer jar now on whatever 3.x core your on.
IpCamera binding - Breaking changes and new features in 3.2 Milestone 3 and newer - Add-ons / Bindings - openHAB Community
Tried the current 3.2 snapshot ipcamera binding, but the behavior is the same.
I tried Firefox instead of Chrome. In Firefox everything is working well. Edge, Chrome, Opera are not working. Also tried to clear the browser cache, but that’s no difference. Strange…
EDIT: Tried chrome with another win10 machine in my network, which never loaded the page before to avoid potential problems with the browser cache. Same behavior…
how many cameras or streams are showing on the page at the same time? Some browsers have a limit and I think firefox allows for a higher amount which may explain it. Are you trying to watch http urls over a https connection? All I can say is that it is not a binding issue. What happens if you use this widget?
Clickable Camera Widget - Add-on Marketplace / UI Widgets - openHAB Community
There is only one camera on the page and I’m using only http
I also traced the 3.2 binding. Results are nearly the same as with 3.1. Opening the page with the oh-image component doesn’t leave a trace. Right click on the broken image and open in new tab gives following log results:
[DEBUG] [amera.internal.servlet.CameraServlet] - GET:/ipcamera.mjpeg, received from 192.168.50.50
[DEBUG] [amera.internal.servlet.CameraServlet] - First stream requested, opening up stream from camera
[TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.50.72:80/cgi-bin/mjpg/video.cgi?channel=0&subtype=1
Using ClickableCameraImage doesn’t change anything. Here is the yaml for testing the widget:
- component: oh-block
- component: oh-grid-row
- component: oh-grid-col
- component: widget:ClickableCameraImage
I have no idea other then the url your typing in to see openHAB’s UI is a https address and the camera is http. Your test jpg is a https one, so try using a http test url to compare with.
That means the binding never gets asked. If it works in a separate tab then the binding is working and the only thing that may cause an issue that makes sense is what I have written above.
I can not think of any test you can run as you have tried all that I would have suggested. Hopefully someone else has an idea of what to try. You could try using wireshark to see if the browser sends the get request out, but since it works in a new tab I don’t see it helping much.
Ok, I’ve got it.
Obviously I’m a victim of a new chrome security feature as described here:
To solve the problem it is possible to change the behavior of chrome in die windows registry as described here
I’ve tried an entry in HKEY_LOCAL_MACHINE\Software\Policies\Google\Chrome\InsecurePrivateNetworkRequestsAllowed and everything was fine. In the next days I will try https connections, maybe changes in the registry are not necessary when using https.
Im wondering, why there are not more people affected by this feature. I’m using chrome version 96.0.4664.110. I think this issue affects all versions of chromium browsers, which explains my results with opera and edge while firefox was loading the images.
@matt1 Thank you, for your suggestions!
I’m wondering that as well and thanks for posting the fix and what the cause was. What url are you typing in to reach openHAB’s UI? is it a local internal IP, a hostname used, or a IP6 address? If the browser sees it as a public webpage that is re-directing you to a private network it seems to be tripping the security feature. I guess the question is why does it see openHAB as a non local website that is different to what the binding is using?
What url are you typing in to reach openHAB’s UI?
That’s the point. I’m using a local DNS in my private network. I reach openhab in the browser with a local DNS entry (hostname) and not with an ip-address. If I also change the ip-address for the camera binding in the oh-image component to my local domain name, the entry in the windows registry is not necessary. Everything works like a charm, if the real url of the browser is the same as the url in the component.
BTW: I’m back on the 3.1 binding, because for some reason the image of the 3.2 binding is flickering every few seconds.
Try changing oh-image against oh-webframe.
I noticed my camera still keeping the connection open allthough the widget has been closed