Eagle Eye Networks

Our Video API: Getting Previews

May 27, 2014 Hans Kahler

getting previews

This blog post is an example of how you can use the Eagle Eye Networks Video API to embed the preview stream on another site. This is a common request from businesses that want to show their visitors the inside of their facility without a password. Home owners associations, pet hotels, and amusement parks are all examples of this.

Background

The Video API makes it very easy to get the preview stream for all the cameras in an account. The preview stream is a series of JPEG images and requires authentication. Our code today will show how to use the API to provide the images on a webpage without authentication.

Step 1:

We are going to use the code at mcotton/watcher to run a Node.js server that will login, subscribe to the poll stream, notify the client and proxy the image requests. We could remove the poll stream to make the example very basic but it is worth going through it now.

Download or clone the git repository. Keep watching our blog as we add more examples in different languages.

Step 2:

You will need to have Node.js installed (current version is v0.10.26). Once it is installed, open up the command line in the same directory as the example code, you can install the dependencies by running

Edit the file named config.js, replace ‘your_username’ and ‘your_password’ with your username and password

Save the file and start the server

Step 3:

You can now open a browser at go to localhost:3000 and you will see previews show up as they become available on the server.

The code does the following items: authenticates, authorizes, gets a list of devices, subscribes to the poll stream for each of them, listens to the poll stream and notifies the client when a new preview is available.

Because we are subscribed to the poll stream we are only fetching previews when they are available. This makes it very bandwidth efficient.

Conclusion:

You can now treat the image URLs just like static assets on your server. You can put it behind your own firewall or you can make it publicly available. In both cases your username and password are safely stored on the server and never sent to the client.

Tags

Other posts that might interest you

loading

3 ways to maximize the value of security cameras 

Security cameras seem to be everywhere: law enforcement and other public agencies employ cameras, as do businesses of all kinds and an ever-increasing share of households. However, most of what…

April 2, 2024 Eagle Eye Networks

Our Video API: Getting Previews

This blog post is an example of how you can use the Eagle Eye Networks Video API to embed the preview stream on another site. This is a common request from…

May 27, 2014 Hans Kahler

Everything You Need to Know About APIs

More and more, businesses are turning to APIs to drive efficiencies and deliver better customer experiences. In fact, many people use applications that leverage APIs on a daily basis and…

July 9, 2020 Eagle Eye Networks