Skip to content

old vidcontrol notes

ldang edited this page Dec 5, 2015 · 1 revision

Vidcontrol documentation

Dependencies/Assumptions:

  • nginx with proxy setup to proxy the camera
  • no other authentication to clobber the camera's auth

camera is controlled via URLs called via ajax in vidbox.js

  • the host called is the webhost, not the camera. We had to proxy it cause of same-origin policy. You can find it as a constant in vidbox.js
  • 3 URLS: ptz.cgi?query=ptz for camera status, ptz.cgi?move=pan... for movement, and the MJPEG img src.

JS has 2 functions to handle this, getptz and setptz. getptz queries status,and then updates some values for keeping the UI up to date. setptz will tell the camera to move and on successful ajax call will call getptz.

Note that once a movement command has been issued, the camera will not return updated values when queried until the camera has finished the previous movement. This means that spamming commands might cause some commands to be skipped because the javascript can't calculate the correct new position to move to. You can tell when the camera has finished when the numbers in the spinner update. You might even see it move to a number close to what you wanted. It appears the camera can't always get to the exact location you wanted.

Pan and tilts are relatively fast (~1sec) but zooms can take a bit longer. The zoom increments are also smaller to compensate for the smaller zoom range.

The image on the screen is an mjpeg. the html has a parameter for resolution. The higher the number, the lower the resolution.

There are 3 types of controls: directional buttons will move the camera in set increments, sliders allow for moving to specific positions over large distances, and the spinners also move in set increments but allow custom numbers. After typing a new number, if enter is pressed, the camera will update to that new movement.

There is a known bug that when the page first loads the sliders aren't in the correct position. This does not affect their operation.

Tilt: 0=horizon, 45degrees max points downward. Pan: 0-360. Think geometry class. 0 degrees is in quadrant one. increase in degrees pans left.

If something goes wrong, refreshing the page usually works. Let someone know before you do it in case there is a reason not to. If you think the page is going rogue and controlling the camera against your will, alert someone and ask if the page should be closed and then reopened after a few seconds to allow commands to stop.

It's a good idea to become familiar with which numbers correspond to parts of the room. e.g. pan to 180 will point to center of room, etc.

Do not attempt to control a camera already being controlled by another user. Some commands may not execute.

There are some constants in vidbox.js that you might want to change to suit your needs: X_MIN/MAX: the range for movement for the different movement actions p,t,z. X_INCREMENT: the increment used for the directional buttons, not the spinners. The spinner increments are defined later on in the jquery.ready function.

Clone this wiki locally