The server-side of the micro-drama solution supports the upload, management, and processing of micro-drama media. This document helps you understand the preparations required for implementing the micro-drama solution.
Console operations
ApsaraVideo VOD is activated. For more information, see Activate ApsaraVideo VOD.
The system settings required for upload, including the storage path in the specified region and callback settings, are configured. For operation instructions, see Manage storage buckets and Callback settings.
A RAM user is created and used to access ApsaraVideo VOD. To prevent security risks caused by the leakage of the AccessKey pair of your Alibaba Cloud account, we recommend that you create a RAM user and grant the RAM user the permissions required to access ApsaraVideo VOD. Then, use the AccessKey pair (AccessKey ID and AccessKey Secret) of the RAM user to access ApsaraVideo VOD. For operation instructions, see Create and authorize a RAM user.
Configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables. For more information, see Configure environment variables in Linux, macOS, and Windows.
ImportantThe AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M.
We recommend that you do not hard-code the AccessKey ID and AccessKey secret into your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account is compromised.
Integrate the upload SDK for Java
In the following example, Java 1.8 or later and the upload SDK for Java V1.4.15 are used. You can use other versions based on your business requirements. You cannot integrate the upload SDK by directly adding dependencies. You must download and import JAR packages to your project. For more information about how to troubleshoot the errors that may occur when you integrate the upload SDK for Java, see Troubleshooting.
Download the package that contains the upload SDK for Java and sample code.
Version: 1.4.15
Release date: 2022-11-03
Download links: SDK V1.4.15 and demo source code
Decompress the package.
The package VODUploadDemo-java-1.4.15.zip is used in this example. The following subfolders are extracted from the package:
lib: stores JAR packages of the upload SDK for Java.sample: stores the sample code of the upload SDK for Java.
Import JAR packages.
In Eclipse, right-click your project name and choose . Find the decompressed VODUploadDemo-java-1.4.15 folder and add all JAR packages in
libto your project.In IntelliJ IDEA, open your project and choose . On the right side of the Dependencies tab, click the + icon and select JARs or directories. Find the decompressed VODUploadDemo-java-1.4.15 folder and add all JAR packages in
libto your project.
ImportantAfter you import JAR packages, you must configure dependencies.
Add dependencies such as Alibaba Cloud SDK for Java, Object Storage Service (OSS) SDK, ApsaraVideo VOD SDK, and ApsaraVideo VOD server upload SDK.
ImportantYou must integrate all the preceding dependencies. Otherwise, the integration fails.
If you download the latest version of the package aliyun-java-vod-upload-1.4.15.jar, make sure that the version of aliyun-sdk-oss is V3.9.0 or later and the version of aliyun-java-sdk-vod is V2.16.11 or later.
ApsaraVideo VOD is supported in the China (Shanghai), China (Shenzhen), and China (Beijing) regions. If you use the upload SDK for Java V1.4.14 or earlier to upload media files to the China (Shenzhen) or China (Beijing) region, you must use aliyun-java-sdk-vod V2.15.11 or later and aliyun-java-sdk-core V4.4.5 or later. If you use the upload SDK for Java V1.4.15 or later to upload media files to the China (Shenzhen) or China (Beijing) region, you must use aliyun-java-sdk-vod V2.16.11 or later and aliyun-java-sdk-core V4.4.5 or later.