This tutorial shows you how to integrate the backend service APIs for the Alibaba Cloud Short Video Solution app. These services handle data exchange between the app and VOD, process business logic, and manage data.
Overview
The steps and examples in this tutorial are available in Cloud Shell. You can Open in Cloud Shell to get started immediately.
The Short Video Solution is an end-to-end solution that covers the entire lifecycle of short-form video: production (capture and editing), media asset management (storage, transcoding, and review), and content delivery (CDN acceleration and playback). It also provides a production-grade UI, interactive elements, and business-layer source code to build a short video app quickly. The client offers powerful video capturing and editing capabilities, including real-time music, variable speed controls, beauty filters, stickers, special effects, subtitles, and MV templates. It is optimized for high-performance encoding, decoding, and video rendering. The backend provides a rich set of APIs and a management console, letting you call functions as needed to reduce development costs and accelerate time-to-market. The solution's technology stack includes the Spring Boot microservices framework, RDS (MySQL), and the MyBatis persistence framework.
Prerequisites
Activate the following cloud services:
-
Recommended configuration:
-
billing method: pay-as-you-go
-
region: China (Shanghai)
-
CPU: 2-core
-
Memory: 4 GB
-
instance type: I/O optimized
-
operating system: Alibaba Cloud Linux 17.1 64-bit
-
-
Recommended configuration:
-
region: multi-zone (select based on your needs)
-
network: VPC
-
database type: MySQL 5.7 (5.6 or later)
-
storage space: 150 GB (local SSD)
-
specifications: 2-core 4 GB
-
subscription duration: 1 year (select as needed)
-
-
Ensure that all services are created in the same region.
-
Ensure that your account has a balance of at least 100 CNY.
Provision cloud resources
Follow these steps to quickly provision cloud resources such as ECS, RDS, VOD, and RAM.
-
Run the following command to navigate to the tutorial directory,
tutorial-aliyun-quvideo-appserver, in Cloud Shell and install the required dependencies.cd ~/tutorial-aliyun-quvideo-appserver && pip install -r requirements.txt --user -
Configure a domain name. The VOD service requires a domain name. During application deployment, you will be prompted to enter a domain name that you have already configured. For more information, see Add a domain name.
-
Run the following command to download the source code for the Short Video Solution.
cloudshell-git-open https://code.aliyun.com/solutions/AlivcSolution_AppServer.git -
Run the following command to provision the cloud resources.
python configuration/index.py
Deploy the application
Follow these steps to deploy the application to your Alibaba Cloud server.
-
Run the following command to navigate to the source code directory,
AlivcSolution_AppServer, that you downloaded and build the source code.cd ~/AlivcSolution_AppServer && mvn package -
Run the following command to navigate back to the tutorial directory,
tutorial-aliyun-quvideo-appserver, and deploy the application.cd ~/tutorial-aliyun-quvideo-appserver && python deploy/index.py
The sample project includes a user module. For quick deployment, a URL for user avatars is automatically generated. You can also use custom avatars by modifying the value of the AVATARDOMAIN_NAME parameter in the tutorial-aliyun-quvideo-appserver/template/application.properties.template file.
After a successful deployment, the service starts and returns the access URLs for the client, the backend server API, and the management console.
Access the service
After the service starts, test and access it as follows:
-
Access the backend server API
Use the IP address returned by the deployment to test the Short Video Solution service.
http://{public_ip_address}:8080/swagger-ui.htmlAfter a successful deployment, the project's Swagger API documentation page appears. If the page includes API groups such as auth-controller, console-controller, console-user-controller, demo-controller, user-profile-controller, vod-call-back-controller, and vod-controller, the Short Video Solution service is running correctly.
-
Access the management console
Use the IP address returned by the deployment to test the availability of the management console.
http://{public_ip_address}:8080/resource/index.html#/The default username is
adminand the password is12345678. -
Access from a client
-
iOS
In the /AliyunVideoClient_Entrance/AlivcShortVideo/AlivcShortVideoFile/VideoSolution/Model path, find the file named
AlivcQuVideoServerManager.m. In this file, replace the static variable kAlivcQuUrlString with the public IP address of your ECS instance.http://{public_ip_address}:8080 -
Android
In the AlivcLittleVideo/src/main/java/com/aliyun/apsara/alivclittlevideo/constants path, find the file named
AlivcLittleServerApiConstants.class. In this file, replace BASE_URL with the public IP address of your ECS instance.http://{public_ip_address}:8080
NoteThe client application defaults to using HTTPS. Because this deployment does not include an HTTPS configuration, use HTTP to access the service.
-
Clean up resources
When you finish this tutorial, run the following command to delete the cloud resources you created to avoid extra charges.
cd ~/tutorial-aliyun-quvideo-appserver && python delete/index.py