This guide explains how to integrate the short video demo for Android.
Prerequisites
Before you begin, make sure your development environment meets the following requirements.
|
Category |
Description |
|
System version |
Android 4.3 or later. |
|
API version |
API level 18 or higher. |
|
CPU architecture |
ARM64 and ARMv7 on physical devices; simulators are not supported. |
|
Android Studio version support |
Android Studio 3.1 or later. You can download Android Studio. |
Complete the application server setup and start the server before you proceed. For instructions, see application server setup.
Procedure
-
Download the short video demo for Android from Short Video SDK (short video solution) and decompress it.
Directory structure description
- demo - ApsaraVideoQuVideo - |- AlivcLittleVideo # Contains the code for the short video services. - |- AliyunCrop # The cropping module. Contains the code for the cropping UI. - |- AliyunEditor # The editing module. Contains the code for the editing UI. - |- AliyunFileDownLoader # The module for resource downloading and database operations. - |- AliyunRecorder # The module for the recording UI. - |- AliyunSVideoBase # Contains custom views and utility classes. - |- AliyunSvideoMusic # The module for the music UI. - |- AliyunVideoCommon # The common module, which contains utility classes. - |- thirdparty-lib # Contains third-party dependencies required by the demo. - SDK # The SDK used by the project. You can also import an SDK manually. - xxxReleaseNote.md # Release notes. -
Import and configure the project.
-
Open Android Studio, click Open an existing Android Studio project, and then select the ./demo/ApsaraVideoQuVideo folder from the decompressed project files.
-
Configure the server address.
File path: AlivcLittleVideo/src/main/java/com/aliyun/apsara/alivclittlevideo/constantsAlivcLittleServerApiConstants.java.
Modify the
BASE_URLvariable in the file. Set the variable to the public IP address of the ECS instance for the short video application server setup, and add the port number 8080.Example: http://<public IP address of your ECS instance>:8080.
package com.aliyun.apsara.alivclittlevideo.constants; /** * API endpoint URL for the application server. * NOTE: This server is intended for demonstration purposes only. Do not use it in a production environment. * To learn how to integrate your own application server, see the documentation: https://www.alibabacloud.com/help/document_detail/108783.html * @author xlx */ public class AlivcLittleServerApiConstants { /** * Application server base URL. */ public static final String BASE_URL = "http://:8080"; /** * Base URL for video cover images */ public static final String URL_IMAGE_BASE = "https://alivc-demo-vod.aliyuncs.com/"; }
-
-
Compile and run the project.
-
Connect an Android physical device to your computer with a data cable. On your device, enable Developer options and USB debugging in the system settings. After you authorize debugging on your device, select it in Android Studio.
-
Click the build and run button to compile the project, which is then installed and launched on your Android physical device.
-