IP camera auto login (Foscam)

On a different forum (javascript - Auto-login into the IP Camera - Stack Overflow) I have found a PHP file and a script to skip the login page, but I’m note sure where to save these files and if they will work.

<?php $file = 'http://user:password@camera_ip_address/cgi-bin/jpg/image.cgi';

if (file_exists($file)) {
header(‘Content-Type: image/jpeg’);
header(‘Content-Transfer-Encoding: binary’);
header(‘Expires: 0’);
header(‘Cache-Control: must-revalidate’);
header(‘Pragma: public’);
header('Content-Length: ’ . filesize($file));

< img src=“http://yourserver/image.php” width=“640” height=“480” name=“refresh”>
< script language=“JavaScript” type=“text/javascript”>setTimeout(function() {document.images[“refresh”].src = “http://yourserver/image.php?”+math.random();}, 100);< /SCRIPT>


I am new to PHP and I want to make an automatic login script for an IP camera (Foscam FI9831W).
How can I do this and in which folders do I have to save these files?

Perhaps I am being dense (entirely possible) but I don’t see what this has to do with Xibo?

The script has nothing to do with Xibo, but the script needs to be saved on one of the folders on the Xibo server, right? Which folder?

If I understand correctly, the script can sit on any web server - you may well chose to use the Xibo CMS web server to achieve that.

As for which folder - it depends how your web server is configured… the root Xibo folder should work, but i’d recommend at least putting it in a sub folder and if possible in a separate virtual directory.

I see…

Well, I want to add the live stream of the camera in a layout (Webpage). This is also why I’m looking for a way to automatically log in.

It looks like the camera outputs a still image each time you request the web interface - so the solutions you are looking at have some automatic refresh built into them.

Have you tried just putting http://user:password@camera_ip_address/cgi-bin/jpg/image.cgi into an open natively browser module?

I’m afraid there isn’t much mileage in me trying to debug something that exists outside Xibo - I don’t have an IP camera to test with, which will make the process impossible. I don’t see why that script you’ve pasted wouldn’t work if you saved it as “camera.php” in the xibo folder and referenced it in a webpage module.

And by referencing you mean just putting http://user:password@camera_ip_address/cgi-bin/jpg/image.cgi into the Webpage module? Of course I need to change user, password and camera_ip_address.

Exactly so :smile: - the fact there are a lot of posts about this elsewhere indicates that this might not work (although they say it works in firefox - we use IE and Chrome though).

Will this also work with a live video stream because it says ‘image’? :open_mouth:

I’m no expert on that camera - but it looks to me like the feed is only available as a set of still images. You may need to consult with the camera manufacturer to find out if it allows streaming.

I have send the manufacturer a message, but since they know nothing about Xibo, they couldn’t tell me anything. :cry:

The only thing they could tell me was that it is possible to get a RTSP stream from the camera and put this on a website.


Do you know of any IP cam that doesn’t require login credentials or where this could be disabled?

Your question isn’t about Xibo really, its about the camera.

If you can get a RTSP stream then you can embed that directly using the local video module in android: Help setting up RTSP stream for Android - or you can use a VLC embedded item in windows: Is it possible to embed a VLC player or a python player. Perhaps the linked articles will help.

Via VLC I now have managed to get a live stream of the camera (although the stream stops after about 2 minutes), but do I have to use the Embedded module or Local Video?

If I have to use Embedded module, how do I need to set up the HTML, CSS and HEAD content to Embed?

Windows Player: Embedded Module - you should just need the embed HTML.

If the stream stops after 2 minutes then I suggest you set your embedded module duration to something lower, so that Xibo refreshes it.

How can I get the correct embed HTML?

Now I have:

< embed type=“application/x-vlc-plugin” pluginspage=“http://www.videolan.org” version=“VideoLAN.VLCPlugin.2” width=“100%” height=“100%” id=“vlc” loop=“yes” autoplay=“yes” target=“rtsp://elbaut:Herenweg29@”>< /embed>

I have also tried:

< embed type=“application/x-vlc-plugin” pluginspage=“http://www.videolan.org” version=“VideoLAN.VLCPlugin.2” width=“100%” height=“100%” id=“vlc” loop=“yes” autoplay=“yes” target=“rtsp://elbaut:Herenweg29@”>< /embed>

None of them works. :weary:

May I suggest that you get it working on your local machine first - in a standalone webpage (just create test.html and open in Internet Explorer)?

Once you have it working like that, then worry about embedding in Xibo (it should basically be the same)

Apparently the VLC plugin doesn’t work in Windows, so I’ve tested it in Ubuntu and it works. :smile:

But before I install Ubuntu on one of the Xibo clients, can you confirm to me that the VLC plugin is compatible with the Xibo player?

This is the HTML file that I’ve used:

< html>
< head>< title>Demo of VLC mozilla plugin< /title>< /head>

< body>

< h1>Demo of VLC mozilla plugin - Example 1< /h1>

< embed type=“application/x-vlc-plugin”
autoplay=“yes” loop=“yes” width=“400” height=“300”
target=“rtsp://username:password@camera_ip_address:80/videoMain” />
< br />
< a href=“javascript:;” onclick=‘document.video1.play()’>Play video1< /a>
< a href=“javascript:;” onclick=‘document.video1.pause()’>Pause video1< /a>
< a href=“javascript:;” onclick=‘document.video1.stop()’>Stop video1< /a>
< a href=“javascript:;” onclick=‘document.video1.fullscreen()’>Fullscreen< /a>

< /body>
< /html>

The VLC plugin should be OK on Windows. There is no Xibo Player for Linux so you won’t be able to do that.

On an Android Player, all you would need to do is add a LocalVideo module media type and put rtsp://username:password@camera_ip_address:80/videoMain as the video address. You might want to consider that.