Camera2

public protocol Camera2

Camera2 protocol.

Provides access to the device’s camera in order to take pictures and to record videos. Also provides access to various camera settings, such as:

  • Exposure,
  • EV compensation,
  • White balance,
  • Zoom,
  • Recording mode, resolution and framerate selection,
  • Photo mode, format and file format selection.
  • Whether the camera is active.

    Declaration

    Swift

    var isActive: Bool { get }
  • Camera configuration.

    Declaration

    Swift

    var config: Camera2Config { get }
  • Gets a camera component.

    Declaration

    Swift

    func getComponent<Desc>(_ desc: Desc) -> Desc.ApiProtocol? where Desc : Camera2ComponentClassDesc

    Parameters

    desc

    requested component. See Camera2Components for available descriptors instances

    Return Value

    the requested component or nil if not available

  • Gets a camera component and registers an observer notified each time it changes.

    Declaration

    Swift

    func getComponent<Desc: Camera2ComponentClassDesc>(_ desc: Desc,
                    observer: @escaping Ref<Desc.ApiProtocol>.Observer) -> Ref<Desc.ApiProtocol>

    Parameters

    desc

    requested component. See Camera2Components for available descriptors instances

    observer

    observer to notify when the component changes

    Return Value

    reference to the requested component