Edit the Videos by integration of Huawei Video Editor Kit in Android apps (Kotlin)

Murali Akula
Huawei Developers
Published in
4 min readJul 29, 2021

Introduction

In this article, we can learn how to edit the short videos with the help of Huawei Video Editor Kit in your app. Example, if you have captured any video in your mobile and you feel the length is long or background to change or to add any special effects, such functions can be done using this kit.

What is Video Editor Kit?

Video editing is the process of manipulating and rearranging video shots to create a new video. It is the key to blending images and sounds to make us feel emotionally connected and sometimes truly there in the movie we are watching. It is equipped with versatile short video editing functions like video importing/exporting, editing, and rendering. It also provides material libraries, such as special effects, filters and stickers. So, you can do the multiple tasks like titles add, color correction, sound mix etc.

Functions

  • Allows users to delete videos and images in batches, import both videos and images at a time, adjust the sequence and duration of video clips, and easily access the editing screen. Videos with a resolution of 1080 pixel or lower are recommended for better experience.
  • Supports basic editing operations, includes video splitting/deletion, volume/aspect ratio/playback speed adjustment, adding canvases/animations/masks, rotation, cropping, mirroring, copying, and replacement.
  • Allows users to customize filters by modifying parameters like brightness, contrast, saturation, hue, color temperature, and sharpening.
  • Supports picture-in-picture. Users can overlay a video into another video, so added video will appear in a small window floating on original video in full-screen mode.
  • Allows users to export videos in MP4 format, extract any frame from a video or import an image from the photo albums as its cover and set the resolution of the exported video (1080p is maximum).
  • Video supported formats are MP4, MKV, MOV, 3GP, TS, WebM and M4V.

Service Advantages

  • Quick integration: Provides a product-level UI SDK which is intuitive, open, stable, and reliable, it helps add video editing functions to your app quikly.
  • Diverse functions: Offers one-stop services for short video creation, such as video import/export, editing, special effects, stickers, filters, and material libraries.
  • Global coverage: Reaches global developers and supports more than 70 languages.

Requirements

1. Any operating system (MacOS, Linux and Windows).

2. Must have a Huawei phone with HMS 4.0.0.300 or later.

3. Must have a laptop or desktop with Android Studio, Jdk 1.8, SDK platform 26 and Gradle 4.6 installed.

4. Minimum API Level 21 is required.

5. Required EMUI 9.0.0 and later version devices.

How to integrate HMS Dependencies

1. First register as Huawei developer and complete identity verification in Huawei developers website, refer to register a Huawei ID.

2. Create a project in android studio, refer Creating an Android Studio Project.

3. Generate a SHA-256 certificate fingerprint.

4. To generate SHA-256 certificate fingerprint. On right-upper corner of android project click Gradle, choose Project Name > Tasks > android, and then click signingReport, as follows.

Note: Project Name depends on the user created name.

5. Create an App in AppGallery Connect.

6. Download the agconnect-services.json file from App information, copy and paste in android Project under app directory, as follows.

7. Enter SHA-256 certificate fingerprint and click tick icon, as follows.

Note: Above steps from Step 1 to 7 is common for all Huawei Kits.

8. Click Manage APIs tab and enable Video Editor Kit.

9. Add the below maven URL in build.gradle(Project) file under the repositories of buildscript, dependencies and allprojects, refer Add Configuration.

10. Add the below plugin and dependencies in build.gradle(Module) file.

11. Now Sync the gradle.

12. Add the required permission to the AndroidManifest.xml file.

Let us move to development

I have created a project on Android studio with empty activity let’s start coding.

In the MainActivity.kt we can find the business logic.

Create an Object class PermissionUtils.kt to add permissions.

In the activity_main.xml we can create the UI screen.

Demo

Tips and Tricks

1. Make sure you are already registered as Huawei developer.

2. Set minSDK version to 21 or later, otherwise you will get AndriodManifest merge issue.

3. Make sure you have added the agconnect-services.json file to app folder.

4. Make sure you have added SHA-256 fingerprint without fail.

5. Make sure all the dependencies are added properly.

6. You can upload unlimited files.

Conclusion

In this article, we have learned the integration of the Huawei Video Editor Kit in your apps to edit the videos. It is equipped with versatile short video editing functions like video importing/exporting, editing, and rendering. It also provides material libraries, such as special effects, filters and stickers. So, you can do the multiple tasks like titles add, color correction, sound mix etc.

Reference

Video Editor Kit

--

--