Wikitude SDK API Reference

API Docs for: 5.3.0
Show:

hardware Class

Module: AR

hardware includes some general functions which allow interaction with the device itself.

The Singleton instance of the class will automatically be created on World startup and can be accessed via AR.hardware.

Example:
AR.hardware.camera.position = AR.CONST.CAMERA_POSITION.FRONT

Properties

camera.enabled

Boolean

Controls if the camera is active or not.

If the property is set to true, the camera is visible on the screen, and computer vision components are activated. If the property is set to false, the camera will be disabled, a black background will be visible and computer vision components are specifically deactivated.

It is recommended to disable the camera service temporarily when fullscreen HTML is shown. This reduces power consumption and increases performance.

Default: true

camera.features

Object

Queries the capabilities of the device camera, returns informations about min and max zoom levels, supported camera positions, and focus modes.

camera.flashlight

Boolean

Turns the device flashlight on or off. Use the isFlashlightAvailable property to check if the device has a flashlight or not. If the device has no flashlight and the property is set to true, this will have no effect.

Default: false

camera.flashlightAvailable

Boolean

true if the device has a flashlight, false otherwise.

Note that the following permissions are required on Android:

<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-feature android:name="android.hardware.camera.flash" />

Default: false

camera.focusMode

Object

Sets the autofocus mode of the camera, possible values are ONCE to start one-shot autofocus or CONTINUOUS to keep adjusting focus automatically.

Default: AR.CONST.CAMERA_FOCUS_MODE.CONTINUOUS

camera.position

Object

Sets the active camera position, possible values are FRONT or BACK.

Default: AR.CONST.CAMERA_POSITION.BACK

camera.zoom

Number

Sets the zoom level of the camera. Use a value of 1 for no zoom. If a particular value is not supported, a "best match" will be used.

Default: 1

sensors.enabled

Boolean

Controls if the sensors are active or not. Sensors include GPS, mangetometer, accelerometer and gyroscope.

If the property is set to true, any geo-related components (such as GeoObjects and ActionRanges) are active. If the property is set to false, any geo-related components will not be visible on the screen, and triggers will not fire.

It is recommended to disable the sensors when only computer vision components are used. This reduces power consumption and increases performance.

Default: true