User Tools

Site Tools


httpserver

Action Camera Toolbox HTTP server

The Action Camera Toolbox ships with a built in webserver. The server listens on a TCP port (default 2000) for incoming POST requests (multipart/form-data encoded). These can be from any source which can send HTTP request, for instance from a webbrowser. The request should be UTF8 encoded.

Requests support the following variables:

  1. wait=[true|false]: If true then the webserver waits until the script has finished processing. If false then the webserver immediately returns. The default value is true.
  2. script: The script variable contains the script to run on the server.
  3. getLiveStreamPreview=Camera Name (since 1.0.1): If the GET getLiveStreamPreview variable is set then the last available live preview image in JPEG format is returned. The fields wait and script are ignored.

The following example shows how to send a script to the HTTP server using a simple HTML form:

<!-- UTF8 encoded request: -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<form action="http://localhost:2000?wait=true" method="post" enctype="multipart/form-data">
  <label for="script">Script:</label>
  <textarea name="script" id="script" cols="45" rows="5">
// Connect to camera if not connected
var cameraName = "Virtual-Camera";
if (GetCameraState("ConnectionState", cameraName) != "connected")
{
    SetCameraFunction("connectToCamera", cameraName);
}

SetCameraMode("video");
SetCameraFunction("startRecording");
  </textarea>
  <input type="submit" name="button" id="button" value="Submit" />
</form>

The following command gets the last live preview image from the camera named “Virtual Camera”:

http://localhost:2000/?getLiveStreamPreview=Virtual Camera
httpserver.txt · Last modified: 2016/09/23 07:47 by act