Camera screenshot on doorbell

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
Basssment
Posts: 38
Joined: Thursday 18 October 2018 14:04
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: netherlands, Kuuk
Contact:

Camera screenshot on doorbell

Post by Basssment »

Hi all

i'm trying to get a screenshot of my camera in a popup on dashticz when the doorbel is on
I do get a pop up but the field would not show an image. (chrome)
If i try the url directly in chrome i do see an image in the browser.

When i use it on my pc on firefox it does work but not on chrome, my kioskbrowser on my tablet is working on chrome where it should work finaly.

I tried adding the link to the domoticz url of the camera but then all i get is an download of the image.

Who can help me figure out what i am doing wrong

my config.js :

Code: Select all

// Scene deurbel aan
blocks[scene_deurbel_aan] = {}
blocks[scene_deurbel_aan]['title'] = 'Bel'
blocks[scene_deurbel_aan]['width'] = 2;
blocks[scene_deurbel_aan]['hide_data'] = true;
blocks[scene_deurbel_aan]['playsound'] = 'sounds/ping.mp3';
blocks[scene_deurbel_aan]['openpopup'] = {}
blocks[scene_deurbel_aan]['openpopup']['url'] = 'http://user:password@[my cam ip]:80/ISAPI/Streaming/channels/101/picture?user=user&pwd=password';
blocks[scene_deurbel_aan]['openpopup']['auto_close'] = 8; //seconds
Bas
Lokonli
Posts: 2290
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Camera screenshot on doorbell

Post by Lokonli »

Basssment wrote: Wednesday 02 December 2020 21:49 Hi all

i'm trying to get a screenshot of my camera in a popup on dashticz when the doorbel is on
I do get a pop up but the field would not show an image. (chrome)
If i try the url directly in chrome i do see an image in the browser.

When i use it on my pc on firefox it does work but not on chrome, my kioskbrowser on my tablet is working on chrome where it should work finaly.

I tried adding the link to the domoticz url of the camera but then all i get is an download of the image.

Who can help me figure out what i am doing wrong

my config.js :

Code: Select all

// Scene deurbel aan
blocks[scene_deurbel_aan] = {}
blocks[scene_deurbel_aan]['title'] = 'Bel'
blocks[scene_deurbel_aan]['width'] = 2;
blocks[scene_deurbel_aan]['hide_data'] = true;
blocks[scene_deurbel_aan]['playsound'] = 'sounds/ping.mp3';
blocks[scene_deurbel_aan]['openpopup'] = {}
blocks[scene_deurbel_aan]['openpopup']['url'] = 'http://user:password@[my cam ip]:80/ISAPI/Streaming/channels/101/picture?user=user&pwd=password';
blocks[scene_deurbel_aan]['openpopup']['auto_close'] = 8; //seconds
Bas
Maybe Chrome doesn't like to show an image directly, but expects a HTML page.

To test, create a file image.html in for instance the custom folder:

Code: Select all

<image src="http://user:password@[my cam ip]:80/ISAPI/Streaming/channels/101/picture?user=user&pwd=password"></image>
and use in CONFIG.js:

Code: Select all

blocks[scene_deurbel_aan]['openpopup']['url'] = 'custom/image.html'
It can also be a cross origin issue. In that case you can see an error on the network tab of DevTools (F12 to open)

You can fix that by using the cors proxy as url. Use the following url for your image:

Code: Select all

./vendor/dashticz/cors.php?http://user:password@[my cam ip]:80/ISAPI/Streaming/channels/101/picture?user=user&pwd=password
./vendor/
Basssment
Posts: 38
Joined: Thursday 18 October 2018 14:04
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: netherlands, Kuuk
Contact:

Re: Camera screenshot on doorbell

Post by Basssment »

Maybe Chrome doesn't like to show an image directly, but expects a HTML page.

To test, create a file image.html in for instance the custom folder:

Code: Select all

<image src="http://user:password@[my cam ip]:80/ISAPI/Streaming/channels/101/picture?user=user&pwd=password"></image>
and use in CONFIG.js:

Code: Select all

blocks[scene_deurbel_aan]['openpopup']['url'] = 'custom/image.html'
It can also be a cross origin issue. In that case you can see an error on the network tab of DevTools (F12 to open)

You can fix that by using the cors proxy as url. Use the following url for your image:

Code: Select all

./vendor/dashticz/cors.php?http://user:password@[my cam ip]:80/ISAPI/Streaming/channels/101/picture?user=user&pwd=password
./vendor/
Thank you Lokonli!
The image url did not work but the Cors proxy did!
Now only have to figure out how to make the image fit the popup :)

edit:
was a bit to soon :(

it works most of the times but when trying several times in 10% of the popups i get the following error

Warning: file_get_contents(http://[email protected]:80/ISAPI/Streaming/c ... d=password): failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error in /var/www/html/vendor/dashticz/cors.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/dashticz/cors.php:28) in /var/www/html/vendor/dashticz/cors.php on line 33

Bas
Lokonli
Posts: 2290
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Camera screenshot on doorbell

Post by Lokonli »

Probably you can combine both suggestions.

Sent from my SM-A320FL using Tapatalk

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests