Active#

Depending on drone state, a camera may become active or inactive.

For instance, on ANAFI Thermal, the main camera is inactive when the thermal camera is active and the thermal camera is inactive when the main camera is active.

When the drone is disconnected, all cameras are inactive.

When a camera is inactive, most features are unavailable, like photo capture, video recording, zoom control. However, it is still possible to configure camera parameters.

Camera 1#

Sample code to monitor if camera is active:

/** Reference on MainCamera peripheral. */
private var cameraRef: Ref<MainCamera>? = null

/** Monitors and prints active flag. */
fun monitorActive(drone: Drone) {
    cameraRef = drone.getPeripheral(MainCamera::class.java) { camera ->
        // called on main thread when the camera peripheral changes
        camera?.isActive?.run {
            println("Active: $this")
        }
    }
}

Example of output:

Active: true
Active: false

Camera 2#

Sample code to monitor if camera is active:

/** Reference on camera2.MainCamera peripheral. */
private var cameraRef: Ref<MainCamera>? = null

/** Monitors and prints active flag. */
fun monitorActive(drone: Drone) {
    cameraRef = drone.getPeripheral(MainCamera::class.java) { camera ->
        // called on main thread when the camera peripheral changes
        camera?.active?.run {
            println("Active: $this")
        }
    }
}

Example of output:

Active: true
Active: false