CBLCameraDiscovery

Objective-C


@interface CBLCameraDiscovery : NSObject

Swift

class CameraDiscovery : NSObject

Discovery of supported cameras on the network.

  • Returns the shared discovery object.

    Declaration

    Objective-C

    + (nonnull CBLCameraDiscovery *)sharedInstance;

    Swift

    class func sharedInstance() -> CameraDiscovery
  • Returns the manual discovery object, used for discovering cameras based on user input.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nonnull) id<CBLCameraManualDiscovery> manualDiscovery;

    Swift

    var manualDiscovery: any CBLCameraManualDiscovery { get }
  • Begin searching for devices.

    Declaration

    Objective-C

    - (void)beginSearching;

    Swift

    func beginSearching()
  • Stop searching for devices.

    Declaration

    Objective-C

    - (void)stopSearching;

    Swift

    func stopSearching()
  • Sets the client name, which will be displayed on some models of camera during pairing and connection. This should be set before calling -beginSearching, or before using the manualDiscovery object.

    Some cameras display the client name in their UIs, for example during pairing. Make sure it’s something the user recognises — either the name of your app, or the name of their device. Client names should be kept short — cameras will truncate long names.

    The default value will be the CFBundleDisplayName (or CFBundleName if not present) of the main bundle.

    Declaration

    Objective-C

    @property (nonatomic, copy, nonnull) NSString *clientName;

    Swift

    var clientName: String { get set }
  • Sets the discovery mode of the receiver between network only, USB only, or both network and USB.

    Changes to this property will not take effect if the receiver is already searching for devices.

    The default value is CBLCameraDiscoveryModeNetworkAndUSB, although USB cameras will only be detected if operatingSystemIsNewEnoughForWiredCameras returns YES.

    Declaration

    Objective-C

    @property (nonatomic) CBLCameraDiscoveryMode discoveryMode;

    Swift

    var discoveryMode: CameraDiscoveryMode { get set }
  • Returns YES if the current platform is running an operating system that supports wired cameras.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL platformSupportsWiredCameras;

    Swift

    var platformSupportsWiredCameras: Bool { get }
  • Returns YES if the current environment has the authorization to discover wired cameras. If this method returns NO, You must obtain authorization from the using the -attemptToObtainWiredCameraAuthorization: method before cameras can be discovered. Until this property returns YES, wired cameras may be effectively invisible.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL hasAuthorizationToDiscoverWiredCameras;

    Swift

    var hasAuthorizationToDiscoverWiredCameras: Bool { get }
  • Attempt to gain authorization to work with wired cameras. Depending on the operating system in use and the current authorization status, this may trigger one or more dialog boxes to the user.

    This method is for convenience to control the user experience when onboarding, etc.

    Declaration

    Objective-C

    - (void)attemptToObtainWiredCameraAuthorization:
        (void (^_Nonnull)(BOOL))completionHandler;

    Swift

    func attemptToObtainWiredCameraAuthorization() async -> Bool

    Parameters

    completionHandler

    The completion handler that will be called on the main thread when authorization succeeds or fails.

  • Returns the cameras currently available on the network. Can be observed with KVO.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSArray<id<CBLCamera>> *availableCameras;

    Swift

    var availableCameras: [any CBLCamera]? { get }
  • Add an observer callback to be called when the available devices change.

    Declaration

    Objective-C

    - (void)addDevicesChangedObserver:
        (nonnull CBLCameraDiscoveryAvailableDevicesChangedCallback)block;

    Swift

    func addDevicesChangedObserver(_ block: @escaping CameraDiscoveryAvailableDevicesChangedCallback)

    Parameters

    block

    The observer block to add.

  • Remove a previously added observer callback.

    Declaration

    Objective-C

    - (void)removeDevicesChangedObserver:
        (nonnull CBLCameraDiscoveryAvailableDevicesChangedCallback)block;

    Swift

    func removeDevicesChangedObserver(_ block: @escaping CameraDiscoveryAvailableDevicesChangedCallback)

    Parameters

    block

    The observer block to remove.

  • Returns the delegate.

    Declaration

    Objective-C

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

    Swift

    weak var delegate: (any CameraDiscoveryDelegate)? { get set }
  • Returns an array containing the identifiers of all the loaded plugins.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nonnull) NSArray<NSString *> *loadedPluginIdentifiers;

    Swift

    var loadedPluginIdentifiers: [String] { get }
  • Returns an array containing the identifiers of the enabled plugins. By default, all plugins are enabled.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nonnull) NSArray<NSString *> *enabledPluginIdentifiers;

    Swift

    var enabledPluginIdentifiers: [String] { get }
  • Enable or disable a particular plugin. Changes will take effect the next time beginSearching is called.

    Passing an unknown plugin identifier has no effect.

    Declaration

    Objective-C

    - (void)setEnabled:(BOOL)isEnabled
        forPluginWithIdentifier:(NSString *_Nonnull)identifier;

    Swift

    func setEnabled(_ isEnabled: Bool, forPluginWithIdentifier identifier: String)

    Parameters

    isEnabled

    Whether the plugin should be enabled or not.

    identifier

    The identifier of the plugin.