HMS Audio Kit For Customized Music Player

Nithin KC
2 min readNov 9, 2020
HMS Audio Music Player

Introduction

HUAWEI Audio Kit provides a set of audio capabilities based on the HMS Core ecosystem, including audio encoding and decoding capabilities at the hardware level and system bottom layer. It provides developers with convenient, efficient, and rich audio services.

Audio Kit provides developers with the ability to parse and play multiple audio formats such as m4a / aac / amr / flac / imy / wav / ogg / rtttl / mp3. It can provide cache capabilty and support customizig the size of the cache space.

Prerequisites

  • Java JDK (JDK 1.7 is recommended.)
  • Android Studio 3.X
  • SDK Platform 19 or later
  • Gradle 4.6 or later
  • HMS Core (APK) 5.0.0.300 or later

Integration

1. Create a project in android studio and Huawei AGC.

2. Provide the SHA-256 Key in App Information Section.

3. Download the agconnect-services.json from AGCand save into app directory.

4. In root build.gradle

Navigate to allprojects > repositories and buildscript > repositories and add the given line.

5. In app build.gradle

Configure the Maven dependency

6. Permissions in Manifest

Code Implementation

Here is an Audio application which is using HMS Audio Kit features. The application gives an excellent audio experience with audio streaming from a third-party cloud platform. The application listing song details with a name and duration. User can select the track from the list and can listen the music. The application uses recycleview and cardview libraries apart from HMS Audio Kit library.

1.Create an audio management instance by calling HwAudioManager; manage audio playback by calling HwAudioPlayerManager; manage audio queues by calling HwAudioQueueManager;manage audio configurations by calling HwAudioConfigManager.

2. Create a Playlist. Here using ArrayList

3. Play Audio

4. Pause Audio

5. For Next track

6. For previous track

7. Select a track from recycleview

Screen Shots:

HMS Audio Kit Playing Music

Conclusion

Audio Kit provides an excellent experience in Audio playback. It allows developers to quickly build their own local or online playback applications. It can provide a better hearing effects based on the multiple audio effects capabilities. It provides a variety of playback control operation methods to facilitate developers to control application operations.

Reference

HMS Guide

--

--