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.
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 Control | Type | Signature | Description |
|---|---|---|---|
initialize | Method | initialize() | Creates and initializes a camera controller for the current properties |
availableCameras | Method | availableCameras() | Queries the list of available cameras and caches it internally |
setDescription | Method | setDescription(cameraName) | Switches to the camera with the given name |
buildPreview | Method | buildPreview() | Returns a live preview widget |
pausePreview | Method | pausePreview() | Pauses the preview |
resumePreview | Method | resumePreview() | Resumes a paused preview |
takePicture | Method | takePicture() | Takes a single photo |
startImageStream | Method | startImageStream() | Starts preview frame streaming |
stopImageStream | Method | stopImageStream() | Stops frame streaming |
supportsImageStreaming | Method | supportsImageStreaming() | Returns whether image streaming is supported |
prepareForVideoRecording | Method | prepareForVideoRecording() | Prepares video recording (iOS only) |
startVideoRecording | Method | startVideoRecording() | Starts video recording |
stopVideoRecording | Method | stopVideoRecording() | Stops video recording |
pauseVideoRecording | Method | pauseVideoRecording() | Pauses video recording |
resumeVideoRecording | Method | resumeVideoRecording() | Resumes a paused recording |
setZoomLevel | Method | setZoomLevel(zoom) | Sets the zoom level |
setFlashMode | Method | setFlashMode(mode) | Sets the flash mode |
setExposureMode | Method | setExposureMode(mode) | Sets the exposure mode |
setExposurePoint | Method | setExposurePoint(point) | Sets the exposure metering point |
getMaxZoomLevel | Method | getMaxZoomLevel() | Gets the maximum zoom level (not supported in the current version) |
getMinZoomLevel | Method | getMinZoomLevel() | Gets the minimum zoom level (not supported in the current version) |
getMinExposureOffset | Method | getMinExposureOffset() | Gets the minimum exposure offset (EV) (not supported in the current version) |
getMaxExposureOffset | Method | getMaxExposureOffset() | Gets the maximum exposure offset (EV) (not supported in the current version) |
getExposureOffsetStepSize | Method | getExposureOffsetStepSize() | Gets the exposure offset step size (not supported in the current version) |
setExposureOffset | Method | setExposureOffset(offset) | Sets the exposure offset (EV) |
setFocusMode | Method | setFocusMode(mode) | Sets the focus mode |
setFocusPoint | Method | setFocusPoint(point) | Sets the focus point |
lockCaptureOrientation | Method | lockCaptureOrientation(orientation?) | Locks the capture orientation |
unlockCaptureOrientation | Method | unlockCaptureOrientation() | Releases the capture orientation lock |
saveFileToGallery | Method | saveFileToGallery(filePath, name, isReturnPathOfIOS) | Saves an existing file to the device gallery |
saveImageBase64ToGallery | Method | saveImageBase64ToGallery(base64Image, quality, name, isReturnImagePathOfIOS) | Saves a base64 image to the gallery |
Property
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 thatavailableCamerasreports - 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.0–1.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.
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.
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.
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.
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.
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.0–1.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 savename- String ornull. 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 bytesquality- Number. Encoding quality hint (0–100)name- String ornull. 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
Not applicable — the Camera widget has no dedicated Event.
Common Widget Control (all widgets)
Every widget supports name-based common Widget Control (Method) calls such as setProperty, getProperty, and setStyleProperty. See the common reference doc (to be written).