Software Development Kit (SDK)
The purpose of this document is to help software developers familiarize with the functionalities provided in the Video Insight SDK.
The Video Insight SDK contains a set of API functions for the following tasks:
- Start/stop recording of cameras
- Activate/Deactivate program control channels for user-defined events
- Play live video
- Play recorded video
- Get live image stream
To perform theses functions, the SDK sends TCP commands to the Video Insight Server, which processes the commands, and executes the requested actions. The SDK is available in a .Net class library, VideoInsight.SDK.dll. Thus, it requires the Microsoft .Net Framework 1.1. Additionally, the TCP communication utility functions are in a second .Net class library, VideoInsight.Management.dll.
A VB.Net demo program gives examples on how to invoke the SDK functions. Please refer to the source code in the Demo program for the following description.
The Video Insight SDK exposes 2 classes and 2 windows.
Messenger
The messenger class is responsible for sending one way command to the server. An IP address for the server must be given before sending any command. The messenger can send start/stop recording commands for cameras. It can also send activate/deactivate commands for program control channels, which is used to trigger user-defined events.
LiveStream
The livestream class is responsible for streaming images from the server. This class is the workhorse behind the LiveWindow. If you just want to launch a window to display live video, LiveWindow serves the need. However, if an individual live image is desirable, the GetOneLiveImage function is provided to return an MJPG image.
If you want to get a continuous stream of images, and handle the return in your program, you will need to follow this list:
- Instantiate a LiveStream object
- Call the SetParameters method to set the IP address and camera number
- Write a callback function to handle the images (See example below)
============================================== VB.NET ============================================== Public Sub MyCallBack(ByVal tmpArray As Byte()) Dim gch As GCHandle Dim ImagePtr As IntPtr Try ImagePtr = Marshal.AllocHGlobal(tmpArray.Length) Marshal.Copy(tmpArray, 0, ImagePtr, tmpArray.Length) If Nothing Is m_DrawDib Then m_DrawDib = New DrawDib(320, 240, MJPG, 24) End If m_DrawDib.Draw(tmpArray.Length, m_Handle.ToInt32, 0, 0, _ lblLive.Width, lblLive.Height, ImagePtr.ToInt32) Catch ex As Exception Finally Marshal.FreeHGlobal(ImagePtr) End Try End Sub ============================================== - Call the SetCallbackFunction to pass your callback function's address
SetCallbackFunction(AddressOf MyCallBack)
- Call StartLive to start the receiving, and StopLive to stop.
LiveWindow
LiveWindow is the fast way to start playing live video without concerning a developer with the details of streaming. Simply, create a LiveWindow with the server's IP address and camera number. However, the LiveWindow as part of your program should be managed. The demo program gives an example.
PlaybackWindow
PlaybackWindow is used to play a recorded video file. In addition to the server's IP and camera number, you should give the shared folder of the recorded video, the date of the record video, and the time-formatted file name.
