Camera SDK

Description

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

SDK configuration

Configuration Environment

Aqara environment:
framework:
LMCameraFramework.framework
LMMeshDriverFramework.framework
CameraP2PSDK.framework
LMMeshDriver_UI.framework
LMCommonUI.framework
LMFramework.framework
bundle:
LMCameraFramework.bundle
LMCommonUI.bundle
LMFramework.bundle

As follows:

System environment:

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

Pod environment:
  pod 'SVProgressHUD', '2.2.5'
  pod 'Masonry'
  pod 'TTTAttributedLabel'
  pod 'SDWebImage', '5.3.0'
  pod 'YYModel'
  pod 'MJRefresh'
  pod 'KVOController'
  pod 'JTCalendar', '~> 2.0'
  pod 'AFNetworking', '3.2.0'
  pod 'RealReachability', '~> 1.3.0'
  pod 'AWSS3', '~> 2.8.0'
  pod 'CocoaLumberjack'
  pod 'SSZipArchive'
  pod 'lottie-ios', '~> 2.5.3'
  pod 'UITableView+FDTemplateLayoutCell', '1.6'
  pod 'SCIndexView', '2.2.3'
  pod 'ReactiveObjC', '~> 3.1.0'
  pod 'FMDB'

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:

Import LMFramework #import <LMFramework/LMFramework.h> Initialize LMOpenSDK

Parameter Description
host Aqara device pairing domain name (see open platform)
appId APPID applied from the open platform
appKey APPKey matched with APPID
iconBaseUrl The path of some CDN pictures in the device pairing UI layer
    [LMOpenSDK setServer:@""
                   appId:@“”
                  appKey:@“”
             iconBaseUrl:@""];

Set userInf

Parameter Description
userId User ID
token User token
    [LMOpenSDK setUserId:@“”
                   token:@“”];

Jump to the camera playback page:

Import LMCameraOpenSDKGlobal.h #import <LMCameraFramework/LMCameraOpenSDKGlobal.h> Jump to the camera playback page:

Parameter Description
cameraEntity The constructed camera information entity
navigationController The currently launched navigationController
LMCameraDeviceEntity *cameraEntity = [[LMCameraDeviceEntity alloc] init];
cameraEntity.deviceId = @“”;
cameraEntity.deviceName = @“”;
cameraEntity.deviceModel = @“”;
[LMCameraOpenSDKGlobal pushLMCameraViewControllerWithCameraEntity:cameraEntity navigationController:self.navigationController animated:YES];

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. Implement LMCameraOpenSDKGlobal
Parameter Description
cameraFullModeSettingCallBack Fullscreen setting callback
+ (void)setCameraFullModeSettingCallBack:(void(^ _Nonnull)(NSDictionary * _Nonnull cameraFullModeSettingDict))cameraFullModeSettingCallBack;

And implement the following code

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

This method will be called back when the play page is clicked full screen, please call it at the appropriate position.

Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2024-09-27 21:51:47

results matching ""

    No results matching ""