Tutorial 6 – Zoom Box PTZing
In the previous tutorial, we learned how to Zoom Box PTZ.
In this tutorial, we’ll learn how to PTZ to a preset. A PTZ preset is a predefined pan/tilt/zoom position and can be set up at the NVR.
Like every PTZ action, a connection to the camera is required:
//Grab a camera.
Ocularis.ICamera videoCam = cams.ElementAt(0);
//Force a connection to this camera's NVR and wait until it's valid.
while ((videoCam as OCAdapter.OCCamera).GetDynamicLiveURL() == null)
OCAdapter.OCCamera’s method GetDynamicLiveURL forces a connection to the NVR. A connection to the NVR is required prior to issuing PTZ commands.
Now, let’s cycle through all of the available PTZ presets that the NVR has stored for a camera:
//Get the PTZ Preset set.
IEnumerable<Ocularis.IPTZPreset> presets = videoCam.PTZPresets();
foreach(Ocularis.IPTZPreset preset in presets)
//After we're done with the OCAdapter instance we make sure to logout.
Ocularis.ICamera’s method PTZPresets returns a set of Ocularis.IPTZPreset that are available for this camera. Ocularis.IPTZPreset’s method GetDisplayName, as you can imagine, returns a string whose value is the name of the preset. Ocularis.IPTZPreset’s method Select invokes the preset and the camera will PTZ to that position.
That’s it, you can now PTZ a camera using a PTZ preset.