What Are the Benefits of Creating a Generic Event?
Nx Witness has the /ec2/saveCameraUserAttributesList API call for configuring camera settings (including starting or stopping recording). In addition, combining a Generic Event with the Recording on camera action provides elastic recording capabilities, such as recording duration and pre/post-recording time.
Create a Generic Event and Camera Recording Action
- Open Nx Desktop and connect to Nx Server as an Administrator.
- Right-click on one or more cameras in the Resource Tree and select Camera Settings.
- Switch to the Recording tab and click the switch to enable recording. The schedule can be left blank.
- Open the Main Menu and select System Administration (Ctrl+Alt+A) then click the icon Event Rules.
- Click on Event Rules and click on the Add button. The Event and Action sections will show up at the bottom half of the dialog.
- In the Event section, click the drop-down list next to When and select Generic Event.
- Fill in the following fields for Generic Event:
a. Source (required)
b. Caption (optional)
c. Description (optional) - In the Action section, click the drop-down list next to Do and select Camera Recording.
- Next to at, click the drop-down list and select the camera to record (the camera(s) from step 2) and click Apply.
- Uncheck the interval of action (the interval will be instant).
- Select desired Quality and FPS.
- Select one of the two options for recording duration:
• Recording for a fixed duration
Enter a value in the Fixed duration field (sec/min/hrs).
• Recording for an undefined amount of time (records continuously until Nx Server receives the
stop recording signal through a second Generic Event, associated Soft Trigger, or stopped
manually by the user)
a. Uncheck Fixed duration.
b. To create the "start recording" Generic Event: Set the Pre-Recording time as desired and keep the Post-Recording time as 0 seconds.
c. To create the "stop recording" Generic Event: Set the Pre-Recording time to 0 and set the Post Recording time as desired. - Click Apply to save the changes, then click OK.
NOTE: Nx Witness 3.0 and below does have the option to record for a fixed duration and must choose to record for an undefined amount of time.
Configure an HTTP Request URL to Trigger a Generic Event
Devices that have the ability to send out HTTP requests (for example, the camera itself, a third-party plugin, a computer or mobile phone application, etc.) can trigger the Generic Event you created earlier to start/stop recording.
Change the placeholder values in the HTTP request URL format to match those used in the Generic Event you made earlier in step 7 (source, caption, and description). The two HTTP request URL options are as follows:
• Recording for a fixed duration
http://<server_ip>:<port>/api/createEvent?source=<source>&caption=<caption>&description=<description>
Example: http://127.0.0.1:7001/api/createEvents?source=Interrogation&caption=recording
• Recording for an undefined amount of time (requires the pre/post-recording option to be used in the Generic Event/Camera Recording action above)
For the "Start" soft trigger, replace <status> with Active, and for the "Stop" soft trigger, replace
<status> with Inactive:
http://<server_ip>:<server_port>/api/createEvents?state=<status>&source=<source_text>&caption=<caption_text>&description=<description_text>
Example: http://127.0.0.1:7001/api/createEvents?state=Active&source=Interrogation&caption=recording
Optional - Create a Soft Trigger event and HTTP Request URL action
Expand the above Generic Event's functionality by pairing it with a Soft Trigger event and Do HTTP Request action.
- Open Nx Desktop and connect to Nx Server as an Administrator.
- Open the Main Menu and select System Administration (Ctrl+Alt+A). then click the icon Event Rules.
- Click on Event Rules and click on the Add button. The Event and Action sections will show up at the bottom half of the dialog.
- In the Event section, click the drop-down list next to When and select Soft Trigger.
- Fill in the following fields for Soft Trigger:
a. At: Pick the camera(s) that you want to have the recording button.
b. Available to: Pick the user(s) who can have this button on the screen.
c. Name: You can give an identifier (e.g., Start Recording).
d. Icon: Choose an icon. - In the Action section, click the drop-down list next to Do and select Do HTTP Request.
- Depending on your recording duration type (definded vs undefinded), fill in the following fields for the Do HTTP Request:
• Recording for a fixed duration
a. HTTP URL: Change the placeholder values in the HTTP request URL format to match those used in the Generic Event you made earlier in step 7 (source, caption, and description):http://<server_ip>:<server_port>/api/createEvents?source=<source_text>&caption=<caption_text>&description=<description_text>
b. HTTP content: leave blank
c. Content-type: Auto
d. Authentication type: Auto
e. Request type: GET
f. Login: Your Nx username
g. Password: Your Nx password
• Recording for an undefined amount of time (requires the pre/post-recording option to be used
in the Generic Event/Camera Recording action)
a. Create two Soft Trigger events: The "Start" soft trigger records continuously until a second
"Stop" soft trigger is clicked.
b. For the "Start" soft trigger, replace <status> with Active, and for the "Stop" soft
trigger, replace <status> with Inactive:
http://<server_ip>:<server_port>/api/createEvents?state=<status>&source=<source_text>&caption=<caption_text>&description=<description_text>
Authentication
Please keep in mind that all these requests will require authentication from Nx Server. Nx Server supports basic and digest authentication. Digest is more secure and the workflow is described in the API documentation.
If authentication from Nx Server is successful and there is no misprint in the API method, Nx Server will reply with 200 HTTP status code and JSON with a certain info message. It will tell you either some parameter is missing or be like below if the server accepted the generic event:
{
"error": "0",
"errorString": "",
"reply": null
}
Questions
If you have any questions related to this topic or you want to share your experience with other community members or our team, please visit and engage in our support community or reach out to your local reseller.
Comments
2 comments
why does the pre and post record times not work with Generic Event?? (Latest Version)
Can you submit this question in our community and elaborate a bit more about what was set up?
Article is closed for comments.