06.03.2013 Views

How to Integrate Camera Live View into Web Application? - ACTi

How to Integrate Camera Live View into Web Application? - ACTi

How to Integrate Camera Live View into Web Application? - ACTi

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTi</strong><br />

Knowledge Base<br />

Category: Installation & Configuration Note<br />

Sub-category: Integration<br />

Model: All<br />

Firmware: N/A<br />

Software: N/A Author:<br />

Published: 2009/12/30 Reviewed: 2011/06/30<br />

<strong>How</strong> <strong>to</strong> <strong>Integrate</strong> <strong>Camera</strong> <strong>Live</strong> <strong>View</strong> in<strong>to</strong> <strong>Web</strong><br />

<strong>Application</strong>?<br />

Contents<br />

Introduction<br />

<strong>Application</strong>s<br />

<strong>Live</strong> <strong>View</strong> page introduction<br />

ActiveX control technology<br />

<strong>How</strong> <strong>to</strong> install ActiveX control <strong>to</strong> your system<br />

Start building application with sample code<br />

Display PTZ camera’s live view and control<br />

Display more channels live view<br />

<strong>How</strong> <strong>to</strong> show live view on other browsers<br />

FAQ<br />

Reference<br />

1<br />

www.acti.com


Introduction<br />

You may want <strong>to</strong> embed your camera's live image in<strong>to</strong> your specially designed webpage, in<br />

order <strong>to</strong> let users see the live view anywhere, e.g. live traffic on highway, live view from famous<br />

<strong>to</strong>urist attractions, have a look at pets and see what they are doing, etc. User can view the<br />

video on various devices via different internet types, such as wired LAN, wireless LAN, 3G<br />

network. This article explains how it all works and how <strong>to</strong> set it up.<br />

<strong>Application</strong>s<br />

You can use browsers or multimedia players <strong>to</strong> display the live streaming.<br />

General browsers: Microsoft Internet explorer, Firefox, Safari, Google Chrome,etc.<br />

Multimedia players: Quick time, VLC, Media Player,etc.<br />

Browsers Internet<br />

explorer<br />

<strong>ACTi</strong> <strong>Camera</strong> Video/Audio/All<br />

Multimedia<br />

players<br />

control<br />

You need <strong>to</strong><br />

install ActiveX<br />

control<br />

au<strong>to</strong>matically.<br />

Firefox Safari Google<br />

2<br />

Chrome<br />

Video/Audio Video/Audio Video/Audio<br />

You need <strong>to</strong> use the URL command<br />

http://ip:port/cgi-bin/cmd/encoder?GET_STREAM<br />

Please refer <strong>to</strong> another article:<br />

<strong>How</strong> <strong>to</strong> Watch <strong>Live</strong> Video Using iPhone and iPad<br />

VLC Quick Time Media Player Other <strong>Application</strong><br />

<strong>ACTi</strong> <strong>Camera</strong> Video/Audio Video/Audio NA Video/Audio/PTZ<br />

RTSP URL:<br />

Rtsp://IP_address:RTSP port<br />

It’s only for project<br />

requirement<br />

<strong>ACTi</strong> “Mobile GO!” can<br />

work on iphone/iPAD.<br />

Please install <strong>ACTi</strong><br />

NVR server and<br />

broadcast server.<br />

www.acti.com


Scenario 1: Show live streaming on IE browser<br />

<strong>Web</strong> server<br />

Scenario 2: To embed multimedia player on html file for verious browsers<br />

Scenario 3: Get snapshot from camera and show it on browser directly.<br />

Scenario 4: Broadcast server will send live stream <strong>to</strong> verious browser or target devices, and<br />

cameras can keep live streaming <strong>to</strong> software NVR for recording.<br />

<strong>ACTi</strong><br />

NVR server<br />

3<br />

<strong>ACTi</strong><br />

Broadcast server<br />

<strong>ACTi</strong> “Mobile Go!”<br />

Note** Broadcast server spec <strong>to</strong> be defined depends on potential number of clients using the<br />

service, if you want <strong>to</strong> understand more about broadcast server, please contact <strong>ACTi</strong> sales or<br />

can visit <strong>ACTi</strong> website <strong>to</strong> read “Mobile Server” in <strong>ACTi</strong> Utility first.<br />

Note** “<strong>ACTi</strong> MobileGo” is available on iTunes, it allows you <strong>to</strong> view and control cameras on<br />

iPad, iPhone and iPod!<br />

If you want <strong>to</strong> understand “Mobile Go!”, please visit <strong>ACTi</strong> website <strong>to</strong> read “<strong>ACTi</strong> MobileGo!” in<br />

<strong>ACTi</strong> Utility.<br />

In the following page, we will teach you how <strong>to</strong> design the html page for live view on IE<br />

browser.<br />

Network<br />

Network<br />

www.acti.com


<strong>Live</strong> <strong>View</strong> page Introduction<br />

If your browser is Microsoft Internet Explorer, you need <strong>to</strong> install the ActiveX control on your<br />

computer. This document contains information about how <strong>to</strong> use ActiveX control <strong>to</strong> integrate<br />

the camera live view window in<strong>to</strong> web application. User can embed a camera live view window<br />

in<strong>to</strong> web application, or create a cus<strong>to</strong>mized live view web page.<br />

ActiveX Control Technology<br />

ActiveX controls — small program building blocks — can serve <strong>to</strong> create distributed<br />

applications that work over the Internet through Microsoft Internet Explorer web browser.<br />

Examples include cus<strong>to</strong>mized applications for gathering data, viewing certain kinds of files,<br />

and displaying animation.<br />

<strong>ACTi</strong> camera also included ActiveX control “nvEPLMedia.cab” in<strong>to</strong> firmware, when user<br />

connect <strong>to</strong> camera’s web page, the Internet Explorer will allow embedding the ActiveX control,<br />

then user can view the video streaming in camera’s web page.<br />

If you want <strong>to</strong> embed our ActiveX control in<strong>to</strong> your specially designed webpage, the ActiveX<br />

control “ nvUnifiedControl.ocx” can work with all <strong>ACTi</strong> cameras whatever the camera firmware<br />

is earlier or not.<br />

Here is latest <strong>ACTi</strong> camera’s ActiveX control.<br />

<strong>ACTi</strong><br />

<strong>Camera</strong><br />

ActiveX control Digital signature Internet Explorer<br />

ACM File Name: nvUnifiedControl.ocx<br />

TCM<br />

KCM<br />

Version: 1.2.91.24<br />

Date: 6/8/2011<br />

4<br />

Valid from<br />

9/23/2009 <strong>to</strong><br />

9/24/2012<br />

32-bit version<br />

Internet Explorer's default security settings require that any software available for download must<br />

have a digital signature before download can occur, the file types which will need digital signature,<br />

such as .exe, .cab, .dll, .ocx, .msi, .xpi.<br />

<strong>How</strong> <strong>to</strong> install ActiveX control <strong>to</strong> your system<br />

Generally ActiveX control will be pushed <strong>to</strong> user system au<strong>to</strong>matically. <strong>How</strong>ever, there may be<br />

some cases when the user may not be able <strong>to</strong> download and install the ActiveX control from<br />

the web application. In such case user will need <strong>to</strong> install the ActiveX control manually.<br />

You can find one attachment in this KB named as “ActiveX control Installation Pack.zip”, after<br />

unzipping the file, execute” Register OCX.bat”, it will install the necessary ActiveX control in<strong>to</strong><br />

user system.<br />

www.acti.com


Start building application with sample code for IE browser<br />

You can find sample code attached <strong>to</strong> this article, named as “<strong>Live</strong>DemoSample.htm”.<br />

This sample is a useful example <strong>to</strong> set up a live demo page for guest viewers.<br />

We will highlight the necessary modification which can help you <strong>to</strong> get successful preview with<br />

this sample.<br />

Line 3: Modify the display of the web page title bar<br />

<strong>ACTi</strong> - <strong>Live</strong> Demo<br />

Line47: Modify the camera IP address<br />

NV1.MediaSource = "10.1.1.85";<br />

Line49-50: Modify the camera User Name and Password<br />

NV1.MediaUserName = "Admin";<br />

NV1.MediaPassword = "123456";<br />

Line51-56: Modify the camera port setting<br />

NV1.HttpPort = "80";<br />

NV1.RegisterPort = "6000";<br />

NV1.ControlPort = "6001";<br />

NV1.StreamingPort = "6002";<br />

NV1.MulticastPort = "5000";<br />

NV1.RTSPPort = "7070";<br />

Line72: Modify the live view time. This setting is useful <strong>to</strong> limit the access time for each<br />

connection, you can set this value as 0 if you wish <strong>to</strong> provide a permanent connection.<br />

var nLivingTime = 0;<br />

Line121: Modify the URL which locates the ActiveX control component. You may<br />

choose <strong>to</strong> host this file on your website, or let your user download from <strong>ACTi</strong> server. If you wish<br />

<strong>to</strong> host ActiveX control yourself, just replace the bold text with your URL. If you do not wish <strong>to</strong><br />

host it yourself, you can leave the settings unchanged <strong>to</strong> let your users download from <strong>ACTi</strong><br />

server. Please do not modify other settings in this tag.<br />

<br />

5<br />

www.acti.com


Snapshot for <strong>Live</strong> Demo sample:<br />

6<br />

www.acti.com


Display PTZ camera’s live view and control<br />

You can find sample code attached <strong>to</strong> this article, named as<br />

“<strong>Live</strong>DemoSample_forPTZcamera.htm”.<br />

This sample is a useful example <strong>to</strong> set up a live demo page for guest viewers.<br />

We will highlight the necessary modification which can help you <strong>to</strong> get successful preview with<br />

this sample.<br />

Line 3: Modify the display of the web page title bar<br />

<strong>ACTi</strong> - PTZ camera <strong>Live</strong> Dem<br />

Line47: Modify the camera IP address<br />

NV1.MediaSource = "10.1.1.85";<br />

Line49-50: Modify the camera User Name and Password<br />

NV1.MediaUserName = "Admin";<br />

NV1.MediaPassword = "123456";<br />

Line51-56: Modify the camera port setting<br />

NV1.HttpPort = "80";<br />

NV1.RegisterPort = "6000";<br />

NV1.ControlPort = "6001";<br />

NV1.StreamingPort = "6002";<br />

NV1.MulticastPort = "5000";<br />

NV1.RTSPPort = "7070";<br />

Line58-64: Modify the camera’s PTZ setting. The example is for ACM-8511. For KCM<br />

zoom camera, you can use Vender=“SONY” Pro<strong>to</strong>col=”VISCA” or Vender=“PELCO”<br />

Pro<strong>to</strong>col=”PELCO-D”, it depends what PTZ Vendor setting on camera.<br />

NV1.Vendor="SONY";<br />

NV1.Pro<strong>to</strong>col="VISCA";<br />

NV1.AddressID="1";<br />

NV1.PTZPostMode="1";<br />

NV1.Parity="N81";<br />

NV1.BaudRate="9600";<br />

NV1.PTZPanSpeed = 5;<br />

7<br />

www.acti.com


Line120: Modify the live view time. This setting is useful <strong>to</strong> limit the access time for each<br />

connection, you can set this value as 0 if you wish <strong>to</strong> provide a permanent connection.<br />

var nLivingTime = 0;<br />

Line169: Modify the URL which locates the ActiveX control component. You may<br />

choose <strong>to</strong> host this file on your website, or let your user download from <strong>ACTi</strong> server. If you wish<br />

<strong>to</strong> host ActiveX control yourself, just replace the bold text with your URL. If you do not wish <strong>to</strong><br />

host it yourself, you can leave the settings unchanged <strong>to</strong> let your users download from <strong>ACTi</strong><br />

server. Please do not modify other settings in this tag.<br />

<br />

Snapshot for <strong>Live</strong> Demo sample:<br />

8<br />

www.acti.com


Display more channels live view<br />

You can refer <strong>to</strong> the sample code attached <strong>to</strong> this article, named as<br />

“<strong>Live</strong>DemoSample_4channelPreview.htm”.<br />

This sample is a useful example <strong>to</strong> set up a live demo page for guest viewers.<br />

Snapshot for 4 channels <strong>Live</strong> Demo sample:<br />

9<br />

www.acti.com


<strong>How</strong> <strong>to</strong> show live view on other browsers<br />

Due <strong>to</strong> other browsers do not support ActiveX, such as Firefox, Google Chrome,etc. You can<br />

input the URL command <strong>to</strong> show camera’s video.<br />

Please refer <strong>to</strong> another article: <strong>How</strong> <strong>to</strong> Watch <strong>Live</strong> Video Using iPhone and iPad<br />

http://www.acti.com/support/KnowledgeBase/outside/detail.asp?KB_ID=KB20091222001<br />

If the camera supports RTSP, you can plug-in media application <strong>to</strong> show live video, here is an<br />

example which we use Quicktime application.<br />

There is a sample code attached <strong>to</strong> this article, named as<br />

“<strong>Live</strong>DemoSample_plugin_quicktime.html”.<br />

This sample is a useful example <strong>to</strong> set up a live demo page for guest viewers.<br />

We will highlight the necessary modification which can help you <strong>to</strong> get successful preview with<br />

this sample.<br />

Line 2: Modify the display of the web page title bar<br />

<strong>ACTi</strong> - <strong>Live</strong> Demo<br />

Line9 : Modify the camera IP address and RTSP port<br />

<br />

Line18: Modify the camera IP address and RTSP port<br />

qtsrc="rtsp://172.16.26.80:7070"<br />

Snapshot for <strong>Live</strong> Demo sample:<br />

10<br />

www.acti.com


FAQ<br />

Q1: I have bandwidth limitation, if the live view is slow, how should I do?<br />

You can use snapshot and upload the camera’s snapshot <strong>to</strong> FTP server, then your web page<br />

can get file from FTP server directly by the time. <strong>ACTi</strong> camera supports Event Handler<br />

function, it can upload snapshot file <strong>to</strong> FTP server directly.<br />

Or you can select the camera which supports dual stream or multiple streams, then user can<br />

use different resolution and frame rate, so the recording will keep on good quality ,and the live<br />

view can use lower quality <strong>to</strong> save the bandwidth.<br />

Q2: What should I think about when embedding the live view in my website?<br />

You may concern some fac<strong>to</strong>rs<br />

1. Bandwidth limitation on your server site and remote user site.<br />

2. Offer remote user control function on the camera, such as PTZ and record functions<br />

3. Display live view on different browsers, such as IE, Firefox, Safari, Google Chrome.<br />

4. Remote User will use various devices, such as PDA, iphone.<br />

Reference<br />

[1] http://en.wikipedia.org/wiki/ActiveX#ActiveX_controls<br />

11<br />

www.acti.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!