Skip to content
michael edited this page Nov 9, 2015 · 4 revisions

Manages access to camera streaming.

Usage Notes

webCamStart and webCamStop are used to start and stop an Mpeg stream on a given port. webcamAdjustQuality is used to ajust the quality of the streaming video.
cameraStartPreview is used to get access to the camera preview screen. It will generate "preview" events as images become available.
The preview has two modes: data or file. If you pass a non-blank, writable file path to the cameraStartPreview it will store jpg images in that folder. It is up to the caller to clean up these files after the fact. If no file element is provided, the event will include the image data as a base64 encoded string. Event details
The data element of the preview event will be a map, with the following elements defined.

  • format - currently always "jpeg"
  • width - image width (in pixels)
  • height - image height (in pixels)
  • quality - JPEG quality. Number from 1-100
  • filename - Name of file where image was saved. Only relevant if filepath defined.
  • error - included if there was an IOException saving file, ie, disk full or path write protected.
  • encoding - Data encoding. If filepath defined, will be "file" otherwise "base64"
  • data - Base64 encoded image data.

Note that "filename", "error" and "data" are mutual exclusive.

The webcam and preview modes use the same resources, so you can't use them both at the same time. Stop one mode before starting the other.

Min SDK level=8

cameraStartPreview Start Preview Mode. Throws \'preview\' events.
resolutionLevel (Integer) increasing this number provides higher resolution (default=0)
jpegQuality (Integer) a number from 0-100 (default=20)
filepath (String) Path to store jpeg files. (optional)
returns: (boolean) True if successful
cameraStopPreview Stop the preview mode.
webcamAdjustQuality Adjusts the quality of the webcam stream while it is running.
resolutionLevel (Integer) increasing this number provides higher resolution (default=0)
jpegQuality (Integer) a number from 0-100 (default=20)
webcamStart Starts an MJPEG stream and returns a Tuple of address and port for the stream.
resolutionLevel (Integer) increasing this number provides higher resolution (default=0)
jpegQuality (Integer) a number from 0-100 (default=20)
port (Integer) If port is specified, the webcam service will bind to port, otherwise it will pick any available port. (default=0)
webcamStop Stops the webcam stream.
Clone this wiki locally