Intermediate: Integration of Huawei AV Pipeline Kit in Android
Huawei provides various services for developers to make ease of development and provides best user experience to end users. In this article, we will cover integration of Huawei Wireless Kits in Android.
AV Pipeline Kit is released in HMS Core 6.0 in the media field. AV Pipeline Kit provides three major capabilities pipeline customization, video super-resolution, and sound event detection. With a framework that enables you to design your own service scenarios, it equips your app with rich and customizable audio and video processing capabilities. This service provides a framework for multimedia development, bolstered by a wealth of cross-platform, high-performing multimedia processing capabilities. The pre-set plugins and pipelines for audio and video collection, editing, and playback have simplified the development of audio and video apps, social apps, e-commerce apps etc.
- Video playback pipeline
- Video super-resolution pipeline
- Sound event detection pipeline
- Media asset management
- Plugin customization
You need to install Android studio IDE and I assume that you have prior knowledge about the Android and java.
- A computer (desktop or laptop) running Windows 10.
- A Huawei phone (with the USB cable), which is used for debugging.
- Java JDK installation package.
- Android studio IDE installed.
Follows the steps.
1. Create Unity Project.
- Open Android Studio.
- Click NEW Project, select a Project Templet.
- Enter project and Package name and click on Finish.
2. Register as Huawei developer and complete identity verification in Huawei developer’s website, refer to register a Huawei ID.
3. To generate SHA-256 certificate fingerprint. On right-upper corner of android project click Gradle, choose Project Name > app > Tasks > android, and then click signing Report, as follows.
Also we can generate SHA-256 using command prompt.
To generating SHA-256 certificate fingerprint use below command.
5. Download the agconnect-services.json file from AGC, copy and paste in android Project under app directory, as follows
6. Add the below maven URL in build.gradle(Project level) file under the repositories of buildscript, dependencies, for more information refer Add Configuration.
7. Add the below plugin and dependencies in build.gradle(App level)
8. Open AndroidManifest file and add below permissions.
9. Development Procedure.
Create MainActivity.java Class and Add the below code.
Create activity_main.xml layout and add the below code.
Create PlayerActivity.java class and add the below code.
Create activity_player.xml layout and add the below code.
10. To build apk and run in device, choose Build > Generate Signed Bundle/APK > Build for apk or Build and Run into connected device, follow the steps.
Click on respective UI buttons. It will navigate to respective screen as per below images.
Tips and Tricks
- Always use the latest version of the library.
- Add agconnect-services.json file without fail.
- Add SHA-256 fingerprint without fail.
- Make sure dependencies added in build files.
- Make sure you have EMUI 10.1 and later versions.
In this article, we have learnt Object AV Pipeline in android with Java. AV Pipeline Kit is easy to use, high performing, and consumes low power. It provides pre-set pipelines that supports basic media collection, editing, and playback capabilities. You can quickly integrate these pipelines into your app.