Intermediate: Integration of Huawei AV Pipeline Kit in Android
Introduction
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.
Use Case
- Video playback pipeline
- Video super-resolution pipeline
- Sound event detection pipeline
- Media asset management
- MediaFilter
- Plugin customization
Development Overview
You need to install Android studio IDE and I assume that you have prior knowledge about the Android and java.
Hardware Requirements
- A computer (desktop or laptop) running Windows 10.
- A Huawei phone (with the USB cable), which is used for debugging.
Software Requirements
- 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.
https://gist.github.com/42d1597382cbeca371700c20653518db
4. Create an App in AppGallery Connect.
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.
https://gist.github.com/f6206d399aa58a823b7d692fb4f2e5b9
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.
Result
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.
Conclusion
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.
References
Wireless Kit: https://developer.huawei.com/consumer/en/doc/development/Media-Guides/introduction-0000001156025439?ha_source=hms1