Skip to main content

Camera (카메라) Widget Control

A list of the Widget Control (Property · Method · Event) members you use to control the Camera widget from a script. For an introduction to the widget and how to use it, visit Camera.

info

The cameraID in the examples below is the name (ID) you assigned to the Camera widget on the canvas. In scripts, access it as widgetID.member.

Widget Control summary

Widget ControlTypeSignatureDescription
initializeMethodinitialize()Creates and initializes a camera controller for the current properties
availableCamerasMethodavailableCameras()Queries the list of available cameras and caches it internally
setDescriptionMethodsetDescription(cameraName)Switches to the camera with the given name
buildPreviewMethodbuildPreview()Returns a live preview widget
pausePreviewMethodpausePreview()Pauses the preview
resumePreviewMethodresumePreview()Resumes a paused preview
takePictureMethodtakePicture()Takes a single photo
startImageStreamMethodstartImageStream()Starts preview frame streaming
stopImageStreamMethodstopImageStream()Stops frame streaming
supportsImageStreamingMethodsupportsImageStreaming()Returns whether image streaming is supported
prepareForVideoRecordingMethodprepareForVideoRecording()Prepares video recording (iOS only)
startVideoRecordingMethodstartVideoRecording()Starts video recording
stopVideoRecordingMethodstopVideoRecording()Stops video recording
pauseVideoRecordingMethodpauseVideoRecording()Pauses video recording
resumeVideoRecordingMethodresumeVideoRecording()Resumes a paused recording
setZoomLevelMethodsetZoomLevel(zoom)Sets the zoom level
setFlashModeMethodsetFlashMode(mode)Sets the flash mode
setExposureModeMethodsetExposureMode(mode)Sets the exposure mode
setExposurePointMethodsetExposurePoint(point)Sets the exposure metering point
getMaxZoomLevelMethodgetMaxZoomLevel()Gets the maximum zoom level (not supported in the current version)
getMinZoomLevelMethodgetMinZoomLevel()Gets the minimum zoom level (not supported in the current version)
getMinExposureOffsetMethodgetMinExposureOffset()Gets the minimum exposure offset (EV) (not supported in the current version)
getMaxExposureOffsetMethodgetMaxExposureOffset()Gets the maximum exposure offset (EV) (not supported in the current version)
getExposureOffsetStepSizeMethodgetExposureOffsetStepSize()Gets the exposure offset step size (not supported in the current version)
setExposureOffsetMethodsetExposureOffset(offset)Sets the exposure offset (EV)
setFocusModeMethodsetFocusMode(mode)Sets the focus mode
setFocusPointMethodsetFocusPoint(point)Sets the focus point
lockCaptureOrientationMethodlockCaptureOrientation(orientation?)Locks the capture orientation
unlockCaptureOrientationMethodunlockCaptureOrientation()Releases the capture orientation lock
saveFileToGalleryMethodsaveFileToGallery(filePath, name, isReturnPathOfIOS)Saves an existing file to the device gallery
saveImageBase64ToGalleryMethodsaveImageBase64ToGallery(base64Image, quality, name, isReturnImagePathOfIOS)Saves a base64 image to the gallery

Property

info

Not applicable — the Camera widget has no script-specific Property. In scripts, read and write values with the common Widget Control below (getProperty / setProperty).

Method

initialize

Creates and initializes a camera controller that matches the current properties — lens facing, resolution, audio, and flash — then starts the preview.

  • Parameters: None
  • Returns: None

Example

cameraID.initialize();

availableCameras

Queries the cameras available on the device and caches the list internally. setDescription then uses this list.

  • Parameters: None
  • Returns: None

Example

cameraID.availableCameras();

setDescription

Switches to the camera with the given name. If no camera matches, it falls back to the first available camera.

  • Parameters: cameraName - String. The platform camera name that availableCameras reports
  • Returns: None

Example

cameraID.setDescription("0");

buildPreview

Returns a live camera preview widget. If the controller isn't ready, it returns an empty widget.

  • Parameters: None
  • Returns: Widget

Example

cameraID.buildPreview();

pausePreview

Pauses only the live preview and leaves the controller initialized.

  • Parameters: None
  • Returns: None

Example

cameraID.pausePreview();

resumePreview

Resumes a preview that pausePreview stopped.

  • Parameters: None
  • Returns: None

Example

cameraID.resumePreview();

takePicture

Takes a single photo with the current camera.

  • Parameters: None
  • Returns: None

Example

cameraID.takePicture();

startImageStream

Starts streaming camera preview frames. It works only on configurations that support image streams (see supportsImageStreaming).

  • Parameters: None
  • Returns: None

Example

cameraID.startImageStream();

stopImageStream

Stops the frame stream that startImageStream started.

  • Parameters: None
  • Returns: None

Example

cameraID.stopImageStream();

supportsImageStreaming

Returns whether the current camera configuration supports image streaming. If not initialized, it returns false.

  • Parameters: None
  • Returns: bool

Example

cameraID.supportsImageStreaming();

prepareForVideoRecording

Prepares video recording in advance to reduce the delay on the first startVideoRecording call. This is iOS only and does nothing on other platforms.

  • Parameters: None
  • Returns: None

Example

cameraID.prepareForVideoRecording();

startVideoRecording

Starts video recording with the current camera.

  • Parameters: None
  • Returns: None

Example

cameraID.startVideoRecording();

stopVideoRecording

Stops the video recording in progress.

  • Parameters: None
  • Returns: None

Example

cameraID.stopVideoRecording();

pauseVideoRecording

Pauses the video recording in progress.

  • Parameters: None
  • Returns: None

Example

cameraID.pauseVideoRecording();

resumeVideoRecording

Resumes a video recording that pauseVideoRecording stopped.

  • Parameters: None
  • Returns: None

Example

cameraID.resumeVideoRecording();

setZoomLevel

Sets the camera zoom level.

  • Parameters: zoom - Number. A value between the device's minimum and maximum zoom level
  • Returns: None

Example

cameraID.setZoomLevel(2.0);

setFlashMode

Sets the flash mode for the current camera.

  • Parameters: mode - String. One of "off", "auto", "always", or "torch" (case-insensitive). Unknown values are treated as "off"
  • Returns: None

Example

cameraID.setFlashMode("torch");

setExposureMode

Sets the exposure mode for the current camera.

  • Parameters: mode - String. "auto" or "locked" (case-insensitive). Unknown values are treated as "auto"
  • Returns: None

Example

cameraID.setExposureMode("locked");

setExposurePoint

Sets the point where the camera meters exposure. Pass null — or an empty or malformed string — to reset to the default center metering.

  • Parameters: point - String. Normalized coordinates in "dx,dy" form (0.01.0), for example "0.5,0.5" for the center
  • Returns: None

Example

cameraID.setExposurePoint("0.5,0.5");

getMaxZoomLevel

Gets the maximum zoom level the current camera supports.

warning

This isn't available in the current version, and support is planned for a future update. It appears in the script autocomplete list, but it returns no value, so you cannot get a result.

  • Parameters: None
  • Returns: None (not supported in the current version)

Example

cameraID.getMaxZoomLevel();

getMinZoomLevel

Gets the minimum zoom level the current camera supports.

warning

This isn't available in the current version, and support is planned for a future update. It appears in the script autocomplete list, but it returns no value, so you cannot get a result.

  • Parameters: None
  • Returns: None (not supported in the current version)

Example

cameraID.getMinZoomLevel();

getMinExposureOffset

Gets the minimum exposure offset (EV) the current camera supports.

warning

This isn't available in the current version, and support is planned for a future update. It appears in the script autocomplete list, but it returns no value, so you cannot get a result.

  • Parameters: None
  • Returns: None (not supported in the current version)

Example

cameraID.getMinExposureOffset();

getMaxExposureOffset

Gets the maximum exposure offset (EV) the current camera supports.

warning

This isn't available in the current version, and support is planned for a future update. It appears in the script autocomplete list, but it returns no value, so you cannot get a result.

  • Parameters: None
  • Returns: None (not supported in the current version)

Example

cameraID.getMaxExposureOffset();

getExposureOffsetStepSize

Gets the smallest step size by which the exposure offset can change.

warning

This isn't available in the current version, and support is planned for a future update. It appears in the script autocomplete list, but it returns no value, so you cannot get a result.

  • Parameters: None
  • Returns: None (not supported in the current version)

Example

cameraID.getExposureOffsetStepSize();

setExposureOffset

Sets the exposure offset (EV).

  • Parameters: offset - Number. In EV units, within the device's minimum and maximum exposure range
  • Returns: None

Example

cameraID.setExposureOffset(0.5);

setFocusMode

Sets the focus mode for the current camera.

  • Parameters: mode - String. "auto" or "locked" (case-insensitive). Unknown values are treated as "auto"
  • Returns: None

Example

cameraID.setFocusMode("locked");

setFocusPoint

Sets the point where the camera focuses. Pass null — or an empty or malformed string — to reset to the default center focus.

  • Parameters: point - String. Normalized coordinates in "dx,dy" form (0.01.0), for example "0.5,0.5" for the center
  • Returns: None

Example

cameraID.setFocusPoint("0.5,0.5");

lockCaptureOrientation

Locks the capture orientation so captures keep a consistent orientation even when the device rotates. Omit orientation, or pass a value that can't be recognized, to lock to the current device orientation.

  • Parameters: orientation (optional) - String. "portraitUp", "portraitDown", "landscapeLeft", or "landscapeRight" (names in the "portrait_up" form are also accepted)
  • Returns: None

Example

cameraID.lockCaptureOrientation("portraitUp");

unlockCaptureOrientation

Releases the capture orientation lock set by lockCaptureOrientation so captures follow the device orientation again.

  • Parameters: None
  • Returns: None

Example

cameraID.unlockCaptureOrientation();

saveFileToGallery

Saves a file (a photo) that already exists to the device gallery using a native platform channel.

  • Parameters:
    • filePath - String. Path of the file to save
    • name - String or null. Display name for the saved item (optional)
    • isReturnPathOfIOS - Boolean. Requests that iOS return the path of the saved asset
  • Returns: None

Example

cameraID.saveFileToGallery("/path/to/photo.jpg", "MyPhoto", false);

saveImageBase64ToGallery

Decodes a base64-encoded image, writes it to a temporary PNG file, and then saves that file to the device gallery using a native channel.

  • Parameters:
    • base64Image - String. The base64-encoded image bytes
    • quality - Number. Encoding quality hint (0100)
    • name - String or null. File name and display name for the saved item (optional)
    • isReturnImagePathOfIOS - Boolean. Requests that iOS return the path of the saved asset
  • Returns: None

Example

cameraID.saveImageBase64ToGallery("iVBORw0KGgoAAAANSUhEUgAA...", 90, "MyImage", false);

Event

info

Not applicable — the Camera widget has no dedicated Event.

Common Widget Control (all widgets)

note

Every widget supports name-based common Widget Control (Method) calls such as setProperty, getProperty, and setStyleProperty. See the common reference doc (to be written).