What is a Plugin?
Every Plugin is a dynamic library (*.dll/*.so) which can be used to add new capabilities to Powered-by-Nx products (like Nx Witness VMS).
A Plugin implements several abstract classes:
- Engine – a class representing Video Analytics solution. Technically it is a factory of DeviceAgents; each Engine receives its own settings set by the user
- DeviceAgent – a special "worker" for a specific camera, for example, for processing its video stream
Each class declares a manifest – a JSON object declaring its capabilities and settings.
The Plugin Lifecycle
- When the Nx Server application starts it loads all the Plugin libraries from Plugins directory
- Inside each Plugin library, the Nx Server application looks for "Engine factory"
- The Nx Server creates an Engine object using the factory
- Once an Engine is in the system it becomes available to the user; they can enable it on specific cameras and configure it using the Desktop Client interface
- Once an analytic Plugin is enabled on the camera, the Nx Server application creates instances of DeviceAgents to do the work:
For Video Analytics Plugins:
- The Nx Server application sends video frame-by-frame to a special method of a DeviceAgent.
- DeviceAgent does the internal work and sends metadata (detected objects and events) back to the Nx Server.
- Metadata goes to the object database and is used for search and visualization
- Events go to Event Rules Engine. The user can then configure specific actions for those events.
- If a DeviceAgent provides context actions for metadata objects, the Nx Server calls them when the user clicks a corresponding button in the context menu of an object in the Objects panel inside the Nx Desktop Client.
Integrating with a Remote Analytic Product
In cases where a video analytics product works as an independent application or service (not running on the same machine as the Plugin, e.g. cloud-based or “boxed” video analytics solutions), Plugins should be implemented in a way which will connect to the remote solution and transfer data between the Nx Server application and the remote video analytics software.