This topic describes how to integrate the landscape style component of AUI Kits for interactive live streaming on Android. It includes instructions, important notes, and code examples. For more information about use cases for the landscape style and the differences between landscape and portrait styles, see Landscape style.
Source code
Download the source code
To download the source code, go to the open-source project on GitHub: MediaBox-AUIKits.
Directory structure
├── Android // Root directory for the Android platform
│ ├── AUIBaseKits // AUI base component dependency library
│ ├── AUICore // AUI core business logic dependency library
│ ├── AUIEnterpriseLiveApp // AUI enterprise live streaming app
│ └── AUIUikit // AUI business UI component library
Environment requirements
-
Gradle 7.5-bin with plugin version 7.1.2.
-
To set up JDK 11: go to Preferences > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK and select 11. If version 11 is not available, upgrade your Android Studio.
-
Supported devices: Android 5.0 (Lollipop, SDK API Level 21) and later.
-
Development environment: Use Android Studio 4.0 or later.
-
Debugging: Debug on a physical device that runs Android 5.0 or later. Emulators are not currently supported.
Prerequisites
-
You have deployed an AppServer and obtained its domain name. For instructions, see Configure and run the server-side application.
-
You have obtained the license and license key for the stream publishing and player modules of ApsaraVideo for MediaBox. For more information, see Manage licenses.
Run the demo
This section describes how to build and run the demo.
-
Download and extract the demo package. For the download link, see MediaBox-AUIKits.
-
Configure the project. In Android Studio, choose File > Open and select the demo project you downloaded.
-
Configure the license key and license file. In the
Android/AUIEnterpriseLive/src/main/AndroidManifest.xmlfile, enter the license key and license file you obtained by following the instructions in Create an SDK License.<!-- TODO: Enter your license information here. --> <!-- For more information about license integration, see https://help.aliyun.com/document_detail/2391513.html --> <meta-data android:name="com.aliyun.alivc_license.licensekey" android:value="" tools:node="replace" /> <meta-data android:name="com.aliyun.alivc_license.licensefile" android:value="assets/cert/release.crt" tools:node="replace" /> -
Configure the AppServer address. In the
Android/AUICore/AUIAppServer/src/main/java/com/aliyun/auiappserver/RetrofitManager.javafile, enter the URL of your deployed AppServer. For deployment instructions, see Package and run the project./** * TODO: Enter the address of your deployed AppServer here. */ public static class Const { /** * The AppServer address for interactive live streaming using the built-in IM. */ public static final String APP_SERVER_URL_ALIVC = ""; /** * The AppServer address for interactive live streaming using RongCloud IM. */ public static final String APP_SERVER_URL_RONG_CLOUD = ""; /** * The AppServer address for enterprise live streaming using the built-in IM. */ public static final String APP_SERVER_URL_ENTERPRISE = ""; } -
Test on a physical device
-
Connect an Android physical device. Once connected, select the connected device from the device selection drop-down list in the Android Studio toolbar.
-
After the device name appears in the drop-down list, click the Run button in the toolbar to build the project.
-
Install and run the interactive live streaming application on your Android physical device.
-
Quick integration
Import the source code
Obtain the source code repository for enterprise live streaming from the official Alibaba Cloud website or GitHub, and import the corresponding component modules into your project.
Configure the license
AUI Kits and MediaBox SDKs share a unified licensing process. In the console, you can apply for licenses for modules such as stream publishing, short video, the player, and beauty filters. You can also manage the license for each module.
Before you configure the license, you must obtain the license and license key for the stream publishing and player modules of ApsaraVideo for MediaBox. For more information, see Manage licenses.
-
Configure the license key in
AUIEnterpriseLiveApp/src/main/AndroidManifest.xml.<meta-data android:name="com.aliyun.alivc_license.licensekey" android:value="Enter your license key" tools:node="replace" /> -
Rename the .crt file to
release.crtand copy it to theAUIEnterpriseLiveApp/src/main/assets/cert/directory.
Initialize the SDK
Initialization includes registering the project type and replacing the AppServer address. Each project has a Manager class under the App module. Refer to the setup() method to complete the initialization.
In the AUIEnterpriseLiveApp project, locate the AUIEnterpriseLiveManager file and refer to its setup method. We recommend calling this method in your Application class. This process includes the following operations.
Register the project type
private static final String TAG_PROJECT_ENTERPRISE_LIVE = "aui-live-enterprise";
AlivcBase.setIntegrationWay(TAG_PROJECT_ENTERPRISE_LIVE);
Replace the AppServer address
Verify the AppServer address registered in RetrofitManager.
RetrofitManager.setAppServerUrl("$YOU NEED TO CHECK THE APP SERVER URL HERE$");
Other project configurations
The Maven dependency versions in this topic are for reference only. For the latest versions, see README.md.
Maven repository
maven { url 'https://maven.aliyun.com/nexus/content/repositories/releases' }
Gradle dependencies
// Interactive signaling SDK
implementation "com.aliyun.sdk.android:AliVCInteractionMessage:${latest_version}"
// All-in-one SDK (Refer to the config.gradle file in the AndroidThirdParty directory for the latest version of externalAllInOne)
// We recommend that you use the latest version. For more information, see the official website: https://help.aliyun.com/en/apsara-video-sdk/download-sdks
implementation "com.aliyun.aio:AliVCSDK_InteractiveLive:${latest_version}"
Obfuscation configuration
-keep class com.alivc.** { *; }
-keep class com.aliyun.** { *; }
-keep class com.aliyun.rts.network.* { *; }
-keep class org.webrtc.** { *; }
-keep class com.alibaba.dingpaas.** { *; }
-keep class com.dingtalk.mars.** { *; }
-keep class com.dingtalk.bifrost.** { *; }
-keep class com.dingtalk.mobile.** { *; }
-keep class org.android.spdy.** { *; }
-keep class com.alibaba.dingpaas.interaction.** { *; }
-keep class com.cicada.**{*;}
Permission requests
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
FAQ
Interactive live streaming use cases
Technical support
For questions or suggestions about AUI Kits, submit a ticket.