Using Camera

Camera actions include taking a picture, previewing a scene, recording a video, etc. In addition to camera commands of OSC API, LG’s vendor-specific commands add preview and video recording features as well.

Some commands handling camera actions do not return results immediately after the submission of the command. Continuously poll the previously submitted command with the /osc/commands/status API to determine whether the command has finished. See the API description of the commands listed below for more details.

Related Commands: camera.takePicture, camera.startCapture, camera.stopCapture, camera._liveSnapshot

Taking a Picture

To take a picture, send camera.takePicture command to the server (camera). The server responds with an URL which tells the location of the captured image.

Executing an Interval Capture

camera.startCapture command can be used for interval image capture if captureMode option is set to “interval”. If captureNumber option is set 0, the camera executes an open-ended capture. Otherwise the camera executes a non-open-ended capture. Open-ended capture can only be stopped by sending camera.stopCapture command. Non-open-ended capture stops automatically when the camera has taken captureNumber number of images, or can terminate early by sending camera.stopCapture command. For open-ended capture and early termination of non-open-ended capture, camera.stopCapture command returns the result of captured image URLs. For automatic termination of non-open-ended capture, camera.startCapture command returns the result of captured image URLs.

Recording a Video

camera.startCapture command records video if captureMode option is set to “video”. camera.stopCapture command stops recording and returns the result of recorded video URL. Supplementary commands are available to pause or resume recording by sending camera._pauseRecording or camera._resumeRecording command, respectively. The status of recording operation can be checked with camera._getRecordingStatus command.

Taking a Live Snapshot

camera._liveSnapshot command can be used to capture an image while the camera is recording a video. This command can be used only when the camera is in 180° modes.

Watching Preview

To watch preview in MPEG format, send camera._startPreview command to the server to start previewing. The server returns an Uri from which to receive a continuous video stream of preview. Send camera._stopPreview command to stop previewing started by camera._startPreview. The camera._startPreview command supports only mpegts on UDP. camera._startPreview cannot be used while the camera is recording video.


To watch preview in JPEG format, send camera._startStillPreview command to the server to start previewing. The server returns an IP address and a port number from which to receive a continuous video stream of preview. Send camera._stopStillPreview command to stop previewing started by camera._startStillPreview. The camera._startStillPreview command supports only JPEG. camera._startStillPreview can be used only when the camera is recording video.


camera.getLivePreview is another command to get preview. The response contains one shot of the current preview frame of the camera. Repeatedly send this command to build preview stream.


Preview commands on Action CAMLTE :


JPEG Preview with camera._startStillPreview and camera._stopStillPreview is available only on Action CAMLTE.

camera.getLivePreview is unavailable on Action CAMLTE.

camera._startPreview and camera._stopPreview are available only when the camera is not recording.

camera._startStillPreview and camera._stopStillPreview are available only when the camera is recording.


Note that the preview’s field of view is determined in accordance with the direction of the camera lens. Use _cameraId option to change the camera lens setting.


The application should devise a video player on the playback side to show video streams delivered from the camera.

Getting and Setting Device Options

Use camera.setOptions to set any option to the camera before performing camera actions. camera.getOptions give information on the current camera option settings. Refer to the Device Options section for more information on device options.

Navigation