Creating plugins for Agent DVR
Plugins for Agent DVR are created as .Net Standard 2.0 projects which should run on all platforms. To get started download our example project. You will need a recent version of Visual Studio to build it (community version is fine).
Once you have built the project, copy Demo.dll to the Plugins folder within Agent (the Agent directory is in C:\Program Files\Agent on Windows). You may need to create the Plugins folder.
Start or restart Agent so it picks up the plugin. You can now access it by editing a camera or a microphone and going to the Plugins tab. Select the Demo option and click the "..." button to configure it.
The demo plugin applies a mirror effect to the live video and a volume control to audio. It also raises an alert event every 10 seconds.
Source Code Notes
Configuration: Agent uses a mix of xml and json to store settings. Edit the config.xsd file and add the fields you need to store. When you have done that generate the code for the xsd file by calling:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\xsd.exe /c config.xsd
You then need to edit the corresponding json file in the json directory. You can have multiple json files here with locales in the filename. Agent will use the users language to load the correspoding json for display in the web ui. There must always be a config_en.json file as a fallback.
You can add multiple sections to this json file and it will be rendered with tabs in the UI. There are many different controls available here. The most important fields are the "bindto" fields which tell Agent which config xml field to update with the rendered HTML controls. Agent takes care of rendering the controls and storing and updating the settings. See the json files in C:\Program Files\Agent\WebServerRoot\api for examples.
Media Support You can choose to process video, audio or both. You can hard code the Supports field in Main.cs or use config variables in config.xsd like we do in the demo.
Processing The plugin is sent every video frame and audio frame decoded from the device. You can analyse these fields or apply processing to them like we do in the demo.
Alert and Detect To raise an alert or detect event you just need to set _result to "alert" or "detect". Agent handles the rest.
Distribution Created something useful? Please feel free to share it.
Commands Plugin commands are currently not used