AbelCam Forum
Download AbelCam buy Pro
 
 
 
Welcome Anonymous User
05/01/2024 - 01:46 PM
Quick Search:
Quick Jump:
 
Announcements
Latest Topics
 
Better way to host webcam on a homepage
By: Daniel
Rank: Frequent User
Topics: 26
From: Germany
Added: 11/13/2007 - 08:22 PM

I just integrated my cam on my webpage. Since the webpage is not on the home computer where abelcam is running, I stripped the ajax.html file a little and changed the css to fit my needs.
Within the page, the "localhost" site is included in the Zend Framework via Iframe.

A little php checks if I am watching and changes the server-address to localhost or if someone from outside is watching and takes an no-ip url.
To display the current picture, uploaded via timebased-name ftp, I have php check the last picture and display it. I am still looking for a nice way to have some "archive-streams" generated automatically.

What I do not like about this way:
I do not like Iframes.
Taking the ajax.html as a base, it was kinda confusing which code to leave and what code to cut.
Unfortunately the html in the wwwroot from abelcam is not w3c valid at all.

Is there maybe a better way to stream the local abelcam on a public homepage, maybe having all necessary javascript files etc. not on the local machine but on the outside server?

See my results so far http://www.dantan.de/webcam/live

http://www.dantan.de
By: MelvinG
Rank: Magna Cum Laude
Topics: 661
From: Los Angeles, USA
Added: 11/14/2007 - 02:21 AM

Daniel,

I have contemplated this same matter several times and tried a few home made solutions. None of them were "ideal" and eventually I got distracted by other things and never did come up with a perfect solution.

I'm assuming your outside public web server is running some sort of Unix, as mine is.

My first solution, which worked okay, was to write a small Perl script that acted somewhat like a "proxy". The script resided on the public server. When called, it would fetch current.jpg from my localhost and pass it along to the caller. The javascript in the web page was re-arranged so that the source of the image on the page was "myscript.pl" rather than "my.localhost/current.jpg". This accomplishes the goal of streaming from a public server without having to use an iframe, and it keeps visitors from ever connecting directly to your localhost.

The weakness of this is that it doesn't save any bandwidth on your home connection. If you have, say, 5 people watching your stream at once, you get 5 instances of the Perl script hammering away at your connection - no better than having 5 visitors directly connected.

My second solution was to try to write what was essentially a "multicast server" that would run on the public web server. It would run continuously (as a daemon, preferably), and would constantly pull in images from my localhost at the desired framerate. Webpage code used the mulitcast server as the image source , thus visitors to my public site were connecting to my program, not to my localhost. No matter how many were watching, the localhost would see only a single connection (from the multicast server).

That seems to me like the right way to do it. I had it somewhat working at one time but never finished it. There were some timing issues, and it tended to put quite a bit of load on the public server.

Interestingly enough, what I did in my second solution is almost exactly what the AbelCam Agent now does. Hmmm... possible solution! If there were a way to run the Agent on the public server, you could config it such that its "camera" is actually your AbelCam at home. Web page code would use the Agent as the image source.

The catch here of course is that there isn't an Agent for Un*x. Even if there was, I don't know if webhost admins would allow it to be installed and run by users.