Resource Base
Table of contents

iOS API Reference - Regular Camera Methods

updateCameraSettingFromJson

There are Some detailed settings that can be updated from JSON string or file. View JSON data template and explanation To update from JSON string:

Objective-C:

    [dce updateCameraSettingFromJson:@"json string"];

Swift:

    dce.updateCameraSetting(fromJson: "Your json string")

updateCameraSettingFromFile

There are some detailed settings that can be updated from JSON string or file. To update from JSON file:

Objective-C:

    [dce updateCameraSettingFromFile:@"your json file path"];

Swift:

    dce.updateCameraSettingFromFile(fromFile: "Your file path")

This is the template for updateCameraSettingFromJson and updateCameraSettingFromFile:

    {
        //Absolute sharpness value, A threshold value for controlling filter
        "abssharpnessthreshold":200,
        //Sensor value, A threshold value for controlling filter
        "sensorvalue":3,        
        //A threshold value for gray scale analysis
        "graydiffthreshold":30,
        //A threshold for judging whether the device is shaking
        "sharpnessthreshold":0.2,
        //A threshold for judging whether the device is shaking violently
        "sharpnessthresholdlarge":0.4,
        //A threshold value for calculating sharpness
        "absgraythreshold":35,
        //A threshold value for controlling auto zoom
        "conversioncountthreshold":30,
        //A threshold value that controlling auto focus
        "claritythreshold":0.1
    }

getVersion

Users can check the current DCE version by using this API.

Objective-C:

    [dce getVersion];

Swift:

    dce.getVersion()

Camera State

Use getCameraCurrentState, getCameraDesiredState and setCameraDesiredState to make settings on camera state. Get the current status (on/off) of the camera.

Objective-C:

    [dce getCameraCurrentState];

Swift:

    dce.getCameraCurrentState()

Get the desired status (on/off)of the camera.

Objective-C:

    [dce getCameraDesiredState];

Swift:

    dce.getCameraDesiredState()

Use CAMERA_STATE_ON to set the camera on and use CAMERA_STATE_OFF to set it off.

Objective-C:

    [dce setCameraDesiredState:CAMERA_STATE_ON];

Swift:

    dce.setCameraDesiredState(CAMERA_STATE_ON)

pauseCamera and resumeCamera

Note: these APIs are created for pausing & resuming the camera but the camera module is still working when paused. if you want to shut down camera module please use stopScanning.

Objective-C:

    [dce pauseCamera];
    [dce resumeCamera];

Swift:

    dce.pauseCamera()
    dce.resumeCamera()

stopScanning and startScanning

Control the stopping & starting of the camera module.

Objective-C:

    [dce startScanning];
    [dce stopScanning];

Swift:

    dce.startScanning()
    dce.stopScanning()

addCameraListener

Add Camera Listener

Objective-C:

    [dce addCameraListener:self];

Swift:

    dce.addCameraListener(self)

Remove Camera Listener

Objective-C:

    [dce removeCameraListener];

Swift:

    dce.removeCameraListener()

Torch State

Use getTorchCurrentState, getTorchDesiredState and setTorchDesiredState to make settings on torch state Get current torch state (on/off)

Objective-C:

    [dce getTorchCurrentState];

Swift:

    dce.getTorchCurrentState()

Get desired torch state (on/off)

Objective-C:

    [dce getTorchDesiredState];

Swift:

    dce.getTorchDesiredState()

Use TorchState.TORCH_STATE_ON to set the torch on and use TorchState.TORCH_STATE_OFF to set it off.

Objective-C:

    [dce setTorchDesiredState:TorchState.on];

Swift:

    dce.setTorchDesiredState(TorchState.on)

addTorchListener

Objective-C:

    [dce addTorchListener:self];
    [dce removeTorchListener];

Swift:

    dce.addTorchListener(self)
    dce.removeCameraListener()

Camera Position

DCE will use the back camera of your mobile device by default. You can use getCameraPosition to check which camera is activated currently.

Objective-C:

    [dce getCameraPosition];

Swift:

    dce.getCameraPosition()

To change to another camera:

Objective-C:

    [dce switchCameraPosition];

Swift:

    dce.switchCameraPosition()

Resolution Settings

These APIs are created for you to get or change camera resolution settings.

Objective-C:

    [dce getResolution];
    [dce setResolution:Resolution1080P];

Swift:

    dce.getResolution()
    dce.setResolution(Resolution.Quality1080P)

getResolutionList enables users to check all available resolutions that can be set to the current camera.

Objective-C:

    [dce getResolutionList];

Swift:

    dce.getResolutionList()

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version
    • Version 1.0.1
    • Version 1.0
    Change +
    © 2003–2021 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support