Camera SDK Integration

I. Overview

This article mainly introduces how to integrate Lumi camera SDK.

2. Preconditions

  1. Confirm completion Preparation
  2. Confirm the completion of Environment Build

3. Features

3.1 Main Functions

  1. Support Aqara camera streaming playback.
  2. Support Aqara camera control.

3.2 SDK Size

Dependent library Description Size
Webcam playback Play, P2P 23.8MB
Camera Control, Settings Various settings. 21.6MB
Other third-party open source components Components necessary for the SDK to run. 23.9MB
Total - 69.3MB

Note: 69.3MB is the maximum increment of the integrated SDK, that is, when the dependencies of the third-party app and the third-party dependencies of the SDK have no intersection. Normally, it will be less than this value.

3.3 Precautions

The camera SDK requires the host app to support Android 13(targetSdk>=33

4. Integration

4.1 Open the Android Studio project

4.2 Edit build.gradle under the app directory

dependencies {
    implementation 'com.lumi.external:core:2.1.9'
    //Camera playback, streaming and other functions
    implementation 'com.lumi.module:camera:2.6.4'
    //Camera control, setting items and other functions
    implementation 'com.lumi.sdk:rmextra:1.0.0'
}

4.3 Initialization

See Environment Construction - Unified Initialization

Note: Now the third-party app is required to pass in the channel ID (sdkChannel), so that the SDK can process certain services based on the ID. For details, please refer to the documents related to unified initialization (environment construction), otherwise some functions will be abnormal.

4.4 RxJava Unified Error Handling

Since a lot of RxJava is used in the camera SDK, related exceptions need to be handled in the Application, otherwise the application will crash when RxJava reports an error in some cases.

    override fun onCreate() {
        super.onCreate()
        RxJavaPlugins.setErrorHandler {
            it.printStackTrace()
        }
    }

4.5 Necessary configuration for face management

Allow applications to access system albums and camera data for face uploading

<application>
    ...
    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/lm_rm_extra_file_paths" />
    </provider>
</application>

res/xml/lm_rm_extra_file_paths

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <paths>
        <cache-path path="" name="camera_photos"/>
        <external-path path="" name="camera_photos" />
        <files-path path="" name="camera_photos" />
        <root-path path="" name="camera_photos" />
    </paths>
</resources>

5. Code Confusion

-keep class com.lumi.ed.** {*;}
-keep class tv.danmaku.ijk.media.player.** {*;}
-keep class com.p2p.pppp_api.** {*;}
Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2024-04-24 15:18:24

results matching ""

    No results matching ""