Camera SDK

Description

Support iOS minimum system 15.1
Only support arm64 system environment
IDE environment: Xcode >= 14.0
Language: Object-C / Swift

SDK configuration

Configuration Environment

Aqara environment:
framework:
LMCameraFramework.framework
LMMeshDriverFramework.framework
LMMeshDriver_UI.framework
LMSDKDeviceRouter.framework
LMCommonUI.framework
LMCommonUISwift.framework
LMFramework.framework
CameraP2PSDK.framework
CameraThirdFramework.framework
CameraSoundTouch.framework
CameraMiSodium.framework
CameraMiMP4V2.framework
CameraFaad.framework
bundle:
LMCameraFramework.bundle
LMCommonUI.bundle
LMCommonUISwift.bundle
LMFramework.bundle
LMSDKDeviceRouter.bundle

As follows:

System environment:

VideoToolbox AudioToolbox libz.tbd Libbz2.tbd Libiconv.tbd libc++.tbd Libc.tbd As follows:

Pod environment

For Pod integration and third-party dependencies, see the complete Podfile in Environment Build. Camera integration requires at least the following Aqara SDKs:

pod 'LMCameraFramework'
pod 'CameraP2PSDK'
pod 'CameraThirdFramework'
pod 'CameraSoundTouch'
pod 'CameraMiSodium'
pod 'CameraMiMP4V2'
pod 'CameraFaad'
pod 'LMSDKDeviceRouter'

As follows:

At this point, the configuration of the environment related to the Aqara camera is completed.

Privacy - Photo Library Usage Description - When you need to use functions related to uploading or storing pictures or videos, the app needs to use your photo album permission to access the photo album, save photos, and videos.

Privacy - Local Network Usage Description - When it is necessary to find, connect and control devices on the local network, the App needs to use the local network permission.

Privacy - Microphone Usage Description - When you use functions such as video intercom, the App needs to use your microphone permission.

Privacy - Camera Usage Description - When you use functions such as scanning QR codes, adding avatars, and taking pictures to identify devices, the App needs to enable the camera permission.

App Transport Security Settings Allow Arbitrary Loads - YES

Set the H5 resource path in the SDK

Parameter Description
h5UrlPrefix Logs and other H5 related functions need to use
    + (void)setH5UrlPrefix:(NSString *)h5UrlPrefix;

Example:

    [LMOpenSDK setH5UrlPrefix:@"https://cdn.aqara.com/cdn/app/mainland/test-h5/index.html#"];

Read local resource bundle

    [LMDriverConfig sharedInstance].isLocalResource(YES);

SDK Usage

SDK initialization

For unified SDK initialization, see Environment Build. For the camera category, you also need to configure the full-screen playback callback after initialization (see "Camera playback full screen playback configuration" below).

Jump to the camera playback page

Import the header:

#import <LMSDKDeviceRouter/LMSDKDeviceRouter.h>

import LMSDKDeviceRouter

Use LMSDKDeviceRouter to navigate to the device control page. The framework automatically identifies camera devices and routes to the playback page. See Device Control SDK Usage for details.

Objective-C example:

[LMSDKDeviceRouter pushToDeviceControlPageWithDevice:device
                                navigationController:self.navigationController
                                            animated:YES
                                          completion:^(NSError * _Nullable error, id _Nullable result) {
}];

Swift example:

LMSDKDeviceRouter.pushToDeviceControlPage(with: device,
                                          navigationController: self.navigationController,
                                          animated: true) { error, result in
}

Parameter description

Parameter Description
device Device info object (LMDevice, obtained from cloud after pairing)
navigationController Current navigation controller
animated Whether to animate
completion Navigation completion callback

At this point, if the parameters are all correct, you can already see the live video of the camera.

Set up languages:

Import LMFramework #import <LMFramework/LMFramework.h>

languageString Description
zh-Hans Chinese
en English
ru Russian
ko Korean
zh-HK Traditional
zh-Hant-TW Taiwan - Traditional
[LMOpenSDK setLanguage:languageString];

Status bar color configuration:

The color configuration of the status bar requires the cooperation of the host app

  1. You need to first set View controller-based status bar appearance to YES in info.plist.
  1. If it is UINavigaitonController, you need to add a subclass inherited from UINavigationController, set the following code in the subclass, and use the subclass to control. Or add the Category of UINavigaitonController, and rewrite the following code in Category: ```
  2. (UIStatusBarStyle)preferredStatusBarStyle { return [self.topViewController preferredStatusBarStyle]; }

  3. (UIViewController *)childViewControllerForStatusBarStyle { return self.topViewController; } ```

Camera playback full screen playback configuration:

The full-screen playback configuration of the camera requires the cooperation of the host app.

  1. Declare the allowRotation attribute in Appdelegate.h

@property (nonatomic, assign) NSInteger allowRotation;

And override the function in AppDelegate.m:

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window

And implement the function as follows:

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    if (_allowRotation == 1) {
        return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;
    } else if (_allowRotation == 2) {
        return UIInterfaceOrientationMaskLandscapeLeft;
    } else if (_allowRotation == 3) {
        return UIInterfaceOrientationMaskLandscapeRight;
    } else {
        return UIInterfaceOrientationMaskPortrait;
    }
}
  1. Configure the LMCameraOpenSDKGlobal full-screen callback during SDK initialization:

Import the header #import <LMCameraFramework/LMCameraOpenSDKGlobal.h>

Parameter Description
fullScreenSettingCallBack Full-screen setting callback
+ (void)cameraPlayerFullScreenSettingCallBack:(void(^ _Nonnull)(NSDictionary * _Nonnull cameraFullModeSettingDict))fullScreenSettingCallBack;

Objective-C example:

[LMCameraOpenSDKGlobal cameraPlayerFullScreenSettingCallBack:^(NSDictionary * _Nonnull cameraFullModeSettingDict) {
    AppDelegate *appdelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
    appdelegate.allowRotation = [cameraFullModeSettingDict[@"allowRotation"] integerValue];
    [appdelegate application:[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:cameraFullModeSettingDict[@"window"]];
}];

Swift example:

LMCameraOpenSDKGlobal.cameraPlayerFullScreenSettingCallBack { settings in
    if let delegate = UIApplication.shared.delegate as? AppDelegate {
        delegate.allowRotation = settings["allowRotation"] as? Int ?? 0
        let _ = delegate.application(UIApplication.shared, supportedInterfaceOrientationsFor: settings["window"] as? UIWindow)
    }
}

This method is called back when the play page is clicked full screen. Call it during SDK initialization.

lumi LogoCopyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2026-08-26 17:01:17

results matching ""

    No results matching ""