Web3.0 Development Kit Interfaces Description PDF
Web3.0 Development Kit Interfaces Description PDF
0 development kit
Interfaces description
Catalog
1. Overview ................................................................................................................................... 5
1.1 Introduction ...................................................................................................................... 5
1.2 Supported devices ............................................................................................................. 5
1.3 Running environment........................................................................................................ 5
1.4 Revision history ................................................................................................................. 5
2. Error code definition ................................................................................................................. 6
2.1. Abnormal event code ................................................................................................ 6
2.2. Error code .................................................................................................................. 7
3. Function calling sequence ......................................................................................................... 9
4. Function description ............................................................................................................... 10
4.1. Plugin initialization .................................................................................................. 10
4.1.1. Check plugin is installed or not ....................................................................... 10
4.1.2. Web plugin initialization (including plugin event registration) ....................... 10
4.1.3. Embed play plugin ........................................................................................... 12
4.1.4. Write plugin in web ......................................................................................... 12
4.2. Get device information ........................................................................................... 12
4.2.1. Get IP basing on DNS ....................................................................................... 12
4.2.2. Login device..................................................................................................... 12
4.2.3. Logout device .................................................................................................. 13
4.2.4. Get basic information of devices ..................................................................... 13
4.2.5. Get analog channels information .................................................................... 14
4.2.6. Get digital channel infomation ........................................................................ 15
4.2.7. Get zero channel information ......................................................................... 15
4.2.8. Record search .................................................................................................. 16
4.2.9. Get voice intercom channel ............................................................................ 17
4.2.10. Get port ........................................................................................................... 18
4.3. Play and play control ............................................................................................... 18
4.3.1. Start realplay ................................................................................................... 18
4.3.2. Start playback .................................................................................................. 19
4.3.3. Start reverse playback ..................................................................................... 20
4.3.4. Stop play .......................................................................................................... 21
4.3.5. Single frame..................................................................................................... 21
4.3.6. Pause ............................................................................................................... 22
4.3.7. Resume Play .................................................................................................... 22
4.3.8. Slow forward ................................................................................................... 22
4.3.9. Fast forward .................................................................................................... 23
4.3.10. Get OSD time ................................................................................................... 23
4.3.11. Enable sound ................................................................................................... 23
4.3.12. Disable sound .................................................................................................. 23
4.3.13. Set volume....................................................................................................... 24
4.3.14. Capture pictures .............................................................................................. 24
4.3.15. Split screen ...................................................................................................... 24
4.4. Recording ................................................................................................................ 24
4.4.1. Start recording................................................................................................. 24
4.4.2. Stop recording ................................................................................................. 25
4.5. Download record ..................................................................................................... 25
4.5.1. Start downloading ........................................................................................... 25
4.5.2. Get the records downloading status ............................................................... 26
4.5.3. Get the records downloading progress ........................................................... 26
4.5.4. Stop downloading records .............................................................................. 26
4.6. Voice intercom ........................................................................................................ 26
4.6.1. Start voice intercom ........................................................................................ 26
4.6.2. Stop voice intercom......................................................................................... 26
4.7. PTZ control .............................................................................................................. 27
4.7.1. PTZ direction control ....................................................................................... 27
4.7.2. Setting preset .................................................................................................. 27
4.7.3. Calling preset ................................................................................................... 27
4.8. Enlarging image ....................................................................................................... 28
4.8.1. Enable electronic zoom ................................................................................... 28
4.8.2. Disable electronic zoom .................................................................................. 28
4.8.3. Enable 3D zoom............................................................................................... 28
4.8.4. Disable 3D zoom .............................................................................................. 28
4.8.5. Full-screen play ............................................................................................... 28
4.9. Device maintaince ................................................................................................... 29
4.9.1. Export device configuring parameters ............................................................ 29
4.9.2. Import device configuring parameters ............................................................ 29
4.9.3. Restore the default parameters ...................................................................... 29
4.9.4. Restart ............................................................................................................. 29
4.9.5. Start upgrading ................................................................................................ 30
4.9.6. Get upgrading status ....................................................................................... 30
4.9.7. Get upgrading progress ................................................................................... 30
4.9.8. Stop upgrading ................................................................................................ 30
4.9.9. Reconnect........................................................................................................ 31
4.9.10. Open remote configuration ............................................................................. 31
4.10. Plugin information maintaince ................................................................................ 31
4.10.1. Plugin version comparison .............................................................................. 31
4.10.2. Get the local configuring parameters .............................................................. 31
4.10.3. Set the local configuration of plugins .............................................................. 32
4.10.4. Get playing window status .............................................................................. 32
4.11. Draw polygon in window......................................................................................... 33
4.11.1. Set play mode .................................................................................................. 33
4.11.2. Set draw mode ................................................................................................ 33
4.11.3. Set polygon information .................................................................................. 33
4.11.4. Get polygon information ................................................................................. 33
4.11.5. Clear polygon information............................................................................... 33
4.12. Others...................................................................................................................... 34
4.12.1. Folder selection and files’ path ....................................................................... 34
4.12.2. Get the last error code .................................................................................... 34
4.12.3. Send HTTP Request ......................................................................................... 34
4.12.4. Set encapsulation format ................................................................................ 35
4.12.5. Capture picture ............................................................................................... 35
1. Overview
1.1 Introduction
The web 3.0 development kit is developed basing on ActiveX and NPAPI, interfaces are
encapsulated in javascript, so interfaces of javascript will be provided for integration. Functions of
preview, playback, PTZ control and so on are supported via web. This development kit only can be
used for B/S, but not C/S.
Most of devices of Hikvision are supported by this development kit, including DVR, NVR, DVS,
network camera, network speed dome, etc., but devices should support PSIA or ISAPI protocol.
Version Description
The development kit of this version supports synchronous / asynchronous,
cross-domain CGI command (PSIA / ISAPI), but only some basic commands
V1.0.0 can be supported, such as basic device information, channel acquisition, PTZ
control, etc.
Playing mode only support rtsp over tcp and rtsp over udp at present.
V1.0.1 Modify the HTTP interaction course and solve the problem that old version
devices can’t login.
Solve the Bug that NVR can’t call preset
V1.0.2 Solve the problem that RTSP port can’t be obtained for some devices
V1.0.3 Getting stream of private protocol is added, including preview, playback and
reverse playback. The private protocol will be used in tcp mode by default.
V1.0.4 Redesign PTZ operation interface (I_PTZControl), and focus, zoom, aperture
functions are added. The flag of start and stop is also added in this interface.
V1.0.5 Remote configuration library is modified as modeless way (I_RemoteConfig)
to avoid jamming when using firefox.
Extend remote configuration interface (I_RemoteConfig), add language
choice(Chinese and English).
Add Digest Authentication
Solve the problem of 3D zoom
V1.0.9 Add interface: check plugin is installed or not (I_CheckPluginInstall).
Modify web plugin initialization interface (I_IninPlugin): add bWndFull.
Add HTTP request interface (I_SendHTTPRequest).
V1.1.0 Add interface: draw polygon in window(I_SetSnapDrawMode,
I_SetSnapPolygonInfo, I_GetSnapPolygonInfo, I_ClearSnapInfo);
Add interface : capture picture without preview(I_DeviceCapturePic);
Initialize plugin interface(I_InitPlugin), add optional
parameters(iPackageType, cbRemoteConfig, cbDoubleClickWnd,
cbInitPluginComplete), and cbInitPluginComplete is required to define.
For capture, record and download interface, add optional parameter:
bDateDir.
Add interface: I_SetPackageType, set encapsulation format for record and
download files.
Support searching, playing and downloading sub stream recording files.
Support requirejs、seajs.
IP Server/HiDDNS interface: I_GetIPInfoByMode, only supported by 32bit
web SDK with remote configuration lib.
Fix some bugs:
Fix crashed problem when close multiple tab in IE11
Fix failed problem when requesting 256 channels at the same time
Fix failed playback problem in some DS-8632N-I8
Abnormal event callback is disposed in the call back function that users input, the first parameter
is event code (abnormal playback, playback stop and not enough hard disk space), and the
second parameter is the window number of events.
Error code is obtained by calling I_GetLastError, it belongs to the bottom error code. The upper
logical errors have no error code.
PLUGIN_ERROR_NOERROR 0 no error
PLUGIN_ERROR_LOAD_RTSP_FAILED 1 failed to load rtsp library
PLUGIN_ERROR_LOAD_PLAYCTRL_FAILED 2 failed to load play library
PLUGIN_ERROR_LOAD_SYSTRANSFORM_FAILED 3 failed to load code stream
transform wrapping library
PLUGIN_ERROR_LOAD_HTTPCLIENT_FAILED 4 failed to load http library
PLUGIN_ERROR_PARAMETER_ERROR 5 parameter error
PLUGIN_ERROR_ORDER_ERROR 6 Calling sequence error
PLUGIN_ERROR_ALLOC_RESOURCE_FAILED 7 failed to allocate resources
PLUGIN_ERROR_NOT_INITLIB 8 not initialized
PLUGIN_ERROR_OPERTION_NOSUPPORT 9 operation is not supported
PLUGIN_ERROR_OPENFILE_ERROR 10 failed to open files
PLUGIN_ERROR_WRITEFILE_ERROR 11 failed to write files
PLUGIN_ERROR_READFILE_ERROR 12 failed to read files
PLUGIN_ERROR_INIT_HPR_FAILED 13 Failed to initialize hpr
library
PLUGIN_ERROR_AUDIO_MONOPOLIZED 14 sound card is monopolized
PLUGIN_ERROR_CREATE_SOCKET_ERROR 15 failed to create socket
PLUGIN_ERROR_NETWORK_CONNECT_FAILED 16 connection failure
PLUGIN_ERROR_NETWORK_SEND_ERROR 17 failed to send
PLUGIN_ERROR_NETWORK_RECV_ERROR 18 failed to receive
PLUGIN_ERROR_NETWORK_SEND_TIMEOUT 19 send timeout
PLUGIN_ERROR_NETWORK_RECV_TIMEOUT 20 receive timeout
PLUGIN_ERROR_NETWORK_RESOLVE_FAILED 21 domain name resolution
error
PLUGIN_ERROR_XML_PARSE_ERROR 22 xml parsing error
PLUGIN_ERROR_XML_NODE_ERROR 23 xml node error
PLUGIN_ERROR_NO_EXCEL_DRIVER_ERROR 24 Excel driver is not installed
PLUGIN_ERROR_PARSE_URL_FAILED 25 URL parsing failure
PLUGIN_ERROR_LOADRTSPSDKPROC_ERROR 26 can’t find rtsp interface
address
PLUGIN_ERROR_LOADPLAYERSDKPROC_ERROR 27 can’t find play library
interface address
PLUGIN_ERROR_LOADSYSTRANSFORMPROC_ERROR 28 can’t find code stream
transform wrapping library
interface address
PLUGIN_ERROR_LOADHTTPSDKPROC_ERROR 29 can’t find http library
interface address
PLUGIN_ERROR_START_WAVEIN_FAILED 30 failed to start audio
capture
PLUGIN_ERROR_START_WAVEOUT_FAILED 31 failed to start playing audio
PLUGIN_ERROR_INIT_G722_CODEC_FAILED 32 failed to initialize G722
codec
PLUGIN_ERROR_NOT_ENOUGH_DISK_FREESPACE 33 not enough hard disk
PLUGIN_ERROR_FILE_ALREADY_EXIST 34 file has already existed
3. Function calling sequence
program initialization
Embed plugin:
I_InsertOBJECTPlugin
or I_WriteOBJECT_XHTML
Plugin application
Function: I_CheckPluginInstall()
Instruction: check plugin is installed or not (including Chrome version)
Parameters: none
Return value: -2: The Chrome version doesn’t support NPAPI; -1: not installed; 0: installed.
Function: I_WriteOBJECT_XHTML ()
Instruction: Playing plug is inserted in web directly
Parameter: none
Return value: 0-success, -1-failure
<playbackURI>rtsp://172.9.4.222/Streaming/tracks/101/?starttime=20131223T03
0658Z&endtime=20131223T031657Z&name=02000000076000101&am
p;size=115665012</playbackURI>// This node contains record start time, end time,
video name, video size and other information, you need to input this value when
download video.
<metadataDescriptor>motion</metadataDescriptor>//record type: timing-timing
record, motion-motion detection record, motionOrAlarm- motion detection or
alarm, motionAndAlarm- motion detection and alarm, manual-manual recording,
smart- intelligient
</searchMatchItem>
</matchList>
</CMSearchResult>
TransResolution: Resolution
Value range: 1-CIF(352*288/352*240) , 2-QCIF(176*144/176*120) ,
3-4CIF(704*576/704*480) or D1(720*576/720*486) , 255-Auto(Using
current resolution)
4.4. Recording
Return value: It will return a downloading ID that greater than or equal to 0 when success;
otherwise, return -1.
4.5.2. Get the records downloading status
Function: I_StopVoiceTalk ()
Instruction:Stop voice intercom
Parameters: none
Return value: 0-success, -1-failure
4.7. PTZ control
4.9.4. Restart
Function: I_UpgradeStatus ()
Instruction:Get upgrading status to determine whether upgrading is in progress.
Parameters: none
Return value: It returns 0 when success, which represents upgrade is in progress. Otherwise, it
returns -1, which stands for upgrade failure.
Function: I_UpgradeProgress ()
Instruction:Get upgrading progress
Parameters: none
Return value: It will return upgrade ID that greater than or equal to 0 when success; otherwise,
return -1.
Function: I_StopUpgrade ()
Instruction:stop upgrading
Parameters: none
Return value: 0-success, -1-failure
4.9.9. Reconnect
Function: I_CheckPluginVersion ()
Instruction: Plugin version comparison: it can detect whether the plugin is
installed before the plug-in is embedded
Parameters: none
Return value: -2: no plugins -1:need upgrading 0: no need upgrading
Function: I_GetLocalCfg ()
Instruction: Get the local configuring parameters
Parameters: none
Return value: return the local configuring parameters of plugin (XML format)
Note: the format is as follows:
<LocalConfigInfo>
< ProtocolType</ProtocolType> //Protocol type: 0-TCP 2-UDP
<PackgeSize></PackgeSize> //record package size: 0-256M 1-512M 2-1G
<PlayWndType></PlayWndType> //play window type: 0-full 1-4:3 2-16:9
<BuffNumberType></BuffNumberType> // Play Library Buffer Size
<RecordPath> </RecordPath> //the saving path of record
<CapturePath> </CapturePath> //the saving path of captured pictures
during live view
<PlaybackFilePath> </PlaybackFilePath> //the saving path of playback video
<DeviceCapturePath> </DeviceCapturePath>//the saving path of captured
files
<PlaybackPicPath> </PlaybackPicPath> //the saving path of captured
pictures during playback
<DownloadPath> </DownloadPath> //the saving path of downloaded files
during playback
<IVSMode></IVSMode> //whether to enable rules
<CaptureFileFormat></CaptureFileFormat> //the capture pictures’ format
</LocalConfigInfo>
Function: I_SetLocalCfg ()
Instruction: set the local configuration parameters
Parameters: szLocalCofing the string of local configuration
Return value: 0:success -1:failure
Function: I_SetPlayModeType(iMode)
Instruction: set play mode
Parameters: iMode play mode, 0 preview mode(disable polygon), 6 polygon Mode
Return value: 0-success, -1-failure
Note: Preview mode doesn’t support drawing polygon, and polygon mode means enable drawing
polygon.
Function: I_SetSnapPolygonInfo(iWndIndex)
Instruction: get polygon information
Parameters: iWndIndex Play window number
szInfo XML, one or several polygons
Return value: success:XML data, failure:null
Function: I_ClearSnapInfo(iWndIndex)
Instruction: clear polygon information
Parameters: iWndIndex Play window number
Return value: 0-success, -1-failure
4.12. Others
Function: I_GetLastError ()
Instruction: get the last error code
Parameters: none
Return value: It will return last error code.
Function: I_SetPackageType()
Instruction: set encapsulation format
Parameters: iPackageType encapsulation format, 2-PS format 11-MP4 format
Return value: 0-success, -1-failure
Note: The record video and video clips will be encapsulated as such format.