DMSDetectorViewController


@interface DMSDetectorViewController : UIViewController

View controller for detecting Digimarc audio and image marks, and QR and barcodes. This view controller provides camera and audio detection for Digimarc technologies. If permissions have not been given to the application for camera and audio access, this view controller will request them. The implementor must also set the username and password properties before displaying the view controller. The username and password should be a resolver username and password supplied by Digimarc. The DMSDetectorViewControllerDelegate protocol notifies the delegate application when a payload has been detected, or when a payload has been resolved to a payoff for presentation to the user. The view controller will not automatically dismiss when a mark has been found, the implementor is responsible for defining that behavior. The implementor can do things such as dismissing the view controller after detect, or adding another view controller to the navigation stack.

The detector view controller will only turn on the camera or microphone as needed. If audio or image symbologies are not enabled, the relevant hardware will not be turned on. For example, if all the image symbologies are disabled the camera will be turned off. This can be configured before the view controller is displayed, or re-configured while it is displayed.

    • Designated initializer for a new Detector View Controller. *
    • - parameter: nibNameOrNil The name of the nib file to associate with the view controller. The nib file name should not contain any leading path information. If you specify nil, the nibName property is set to nil.
    • - parameter: nibBundleOrNil The bundle in which to search for the nib file. This method looks for the nib file in the bundle’s language-specific project directories first, followed by the Resources directory. If this parameter is nil, the method uses the heuristics described below to locate the nib file.
    • - parameter: APIKey Custom API key to use. Will override any other currently set API key. -(id _Nonnull)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil;

    Declaration

    Objective-C

    - (id _Nonnull)initWithNibName:(nullable NSString *)nibNameOrNil
                            bundle:(nullable NSBundle *)nibBundleOrNil
                            APIKey:(nullable NSString *)APIKey;

    Swift

    init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?, apiKey APIKey: String?)
  • Readonly property that contains a resolver object. May be nil. Implementors can use this resolver to manually resolve payloads, or to manually control resolves.

    Declaration

    Objective-C

    @property (readonly, nullable) DMSResolver *resolver;

    Swift

    var resolver: Resolver? { get }
  • Delegate for view controller.

    Declaration

    Objective-C

    @property (weak, nullable) id<DMSDetectorViewControllerDelegate> delegate;

    Swift

    @IBOutlet weak var delegate: DetectorViewControllerDelegate? { get set }
  • Readonly property for the on screen visualizer. Implementors can use this property to remove the visualizer view, add one of their own, or modify the existing visualizer. Value is nil until the view controller loads. The detector view controller will hide this view until the feature becomes available.

    Declaration

    Objective-C

    @property (readonly, null_unspecified) UIView *audioVisualizerView;

    Swift

    var audioVisualizerView: UIView! { get }
  • Readonly property for on screen user guidance. Implementors can use this property to remove the guidance view, add one of their own, or modify the existing view. Value is nil until the view controller loads. The detector view controller will hide this view until the feature becomes available.

    Declaration

    Objective-C

    @property (readonly, null_unspecified) UIView *userGuidanceView;

    Swift

    var userGuidanceView: UIView! { get }
  • Deprecated

    crosshairsView has been replaced by overlayType. For custom crosshairs or overlays, consider adding a custom subview to the detector view controller.

    Readonly property for on screen crosshairs that are present when the camera is active. Implementors can use this property to remove the crosshairs view, add one of their own, or modify the existing view. Value is nil until the view controller loads. The detector view controller will hide this view until the feature becomes available.

    Declaration

    Objective-C

    @property (readonly, null_unspecified) UIView *crosshairsView;

    Swift

    var crosshairsView: UIView! { get }
  • Types of media that should be handled by the view controller. Defaults to DMSDetectorViewControllerMediaTypeAllTypes.

    Declaration

    Objective-C

    @property (readonly) DMSSymbologies symbologies;

    Swift

    var symbologies: Symbologies { get }
  • Configures if the detector view controller should be actively detecting and returning results.

    Declaration

    Objective-C

    @property BOOL detectionEnabled;

    Swift

    var detectionEnabled: Bool { get set }
  • The AVCaptureDevice to use for video detection. Defaults to the rear facing camera, if available.

    Declaration

    Objective-C

    @property (readonly, nullable) AVCaptureDevice *videoCaptureDevice;

    Swift

    var videoCaptureDevice: AVCaptureDevice? { get }
  • Sets the video capture device to videoCaptureDevice. Raises an exception if videoCaptureDevice is not a video or muxed device.

    Declaration

    Objective-C

    - (BOOL)setVideoCaptureDevice:(nullable AVCaptureDevice *)videoCaptureDevice
                            error:(NSError *_Nullable *_Nullable)error;

    Swift

    func setVideoCaptureDevice(_ videoCaptureDevice: AVCaptureDevice?) throws
  • Sets the audio capture device to audioCaptureDevice. Raises an exception if audioCaptureDevice is not an audio or muxed device.

    Declaration

    Objective-C

    - (BOOL)setAudioCaptureDevice:(nullable AVCaptureDevice *)audioCaptureDevice
                            error:(NSError *_Nullable *_Nullable)error;

    Swift

    func setAudioCaptureDevice(_ audioCaptureDevice: AVCaptureDevice?) throws
  • Sets symbologies and reader options.

    Declaration

    Objective-C

    - (BOOL)setSymbologies:(DMSSymbologies)symbologies
                   options:(NSDictionary<DMSReaderOptionKey, id> *_Nonnull)options
                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func setSymbologies(_ symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:]) throws

    Parameters

    symbologies

    Symbologies to configure the reader to detect.

    options

    Options to configure the reader with.

  • The AVCaptureDevice to use for audio detection. Defaults to the default audio recording device, if available.

    Declaration

    Objective-C

    @property (readonly, nullable) AVCaptureDevice *audioCaptureDevice;

    Swift

    var audioCaptureDevice: AVCaptureDevice? { get }
  • Limits the detection area to a specific region of the view controller. rectOfInterest is defined as a normalized CGRect that defines a portion of the camera’s view to detect in. The view that the camera has may not align with the bounds of the preview layer, and certain parts of the camera frame can be cropped. You should not assume that a percentage of the view controller’s view will work cleanly with rectOfInterest. The previewLayer’s metadataOutputRectConverted can convert between view rects and camera rects. This function should be used to supply values to rectOfInterest. Additionally, consider setting rectOfInterest inside of the viewDidLayoutSubviews function. rectOfInterest may need to be updated when the view controller changes its layout.

    Declaration

    Objective-C

    @property CGRect rectOfInterest;

    Swift

    var rectOfInterest: CGRect { get set }
  • Automatically updates rectOfInterest to match the view bounds. Defaults to false.

    Declaration

    Objective-C

    @property (nonatomic) BOOL automaticallyUpdatesRectOfInterest;

    Swift

    var automaticallyUpdatesRectOfInterest: Bool { get set }
  • The previewLayer used to show the camera image

    Declaration

    Objective-C

    @property (readonly, nullable) AVCaptureVideoPreviewLayer *previewLayer;

    Swift

    var previewLayer: AVCaptureVideoPreviewLayer? { get }
  • A Boolean that allows the capture reader to automatically adjust the focus point of the camera. Defaults to true. Set to false to allow the focus point to be controlled manually.

    Declaration

    Objective-C

    @property BOOL automaticallyAdjustFocusPoint;

    Swift

    var automaticallyAdjustFocusPoint: Bool { get set }
  • Sets an overlay over the camera preview view. Options include crosshairs centered at the rectOfInterest or a mask highlighting the rectOfInterest bounds. Defaults to DMSOverlayTypeNone (no overlay).

    Declaration

    Objective-C

    @property (nonatomic) DMSOverlayType overlayType;

    Swift

    var overlayType: DetectorViewController.OverlayType { get set }