Huawei Video Kit
Huawei Video Kit brings the wonderful experience to playback the high quality videos streaming from a third party cloud platform.
Huawei Video Kit supports the streaming media in 3GP,MP4 or TS formats and comply with HTTP/HTTPS, HLS or DASH.
Huawei Video Kit will also be supporting the video hosting and editing feature in coming versions.
Introduction
Video is visual multimedia source that combines a sequence of images to form a moving picture. The video transmits a signal to a screen and processes the order in which the screen captures should be shown.
Videos usually have audio components that correspond with the pictures being shown on the screen.
Video was first developed for “Mechanical Television” systems which were quickly replaced by cathode ray tube (CRT) and eventually replaced by flat panel displays of several types.
Huawei Video Kit brings the wonderful experience to playback the high quality videos streaming from a third party cloud platform.
Huawei Video Kit supports the streaming media in 3GP,MP4 or TS formats and comply with HTTP/HTTPS, HLS or DASH.
Huawei Video Kit will also be supporting the video hosting and editing feature in coming versions.
Features
Video Kit provides smooth playback.
It provides secure and stable solution.
It leverages the anti-leeching experience so that bandwidth is not drained out.
It allows wide ranging playback controls.
Supports playback authentication.
Development Overview
Prerequisite
Must have a Huawei Developer Account
Must have Android Studio 3.0 or later
Must have a Huawei phone with HMS Core 5.0.0.300 or later
EMUI 3.0 or later
Software Requirements
Java SDK 1.7 or later
Android 5.0 or later
Preparation
Create an app or project in the Huawei app gallery connect.
Provide the SHA Key and App Package name of the project in App Information Section and enable the required API.
Create an Android project.
Note: Video Kit SDK can be directly called by devices, without connecting to AppGallery Connect and hence it is not mandatory to download and integrate the agconnect-services.json.
Integration
Add below to build.gradle (project)file, under buildscript/repositories and allprojects/repositories.
Maven {url ‘http://developer.huawei.com/repo/'}
Add below to build.gradle (app) file, under dependencies.
implementation “com.huawei.hms:videokit-player:1.0.1.300”
Adding permissions
<uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />
<uses-permission android:name=”android.permission.ACCESS_WIFI_STATE” />
<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” />
<! — permissions for root checking on EMUI 10.x and above →
<uses-permission android:name=”com.huawei.permission.SECURITY_DIAGNOSE” />
Development Process
A small trip application has been created to demonstrate the capabilities to Huawei Video Kit.
It lists all the amusement places to visit around with the use of GridView RecyclerView and card view.
To achieve it below classes are created.
Initializing WisePlayer
We have to implement a class that inherits Application and the onCreate() method has to call the initialization API WisePlayerFactory.initFactory().
Creating instance of wise player
wisePlayer = VideoKitPlayApplication.getWisePlayerFactory().createWisePlayer();
WisePlayer layout
Register WisePlayer listeners
Set playback parameters
Set URL for video
wisePlayer.setPlayUrl(new String[] {currentPlayData.getUrl()});
Set a view to display the video.
activity main.xml
Create a view for Recycler View.
select_play_view
Create card view for displaying the trip locations.
Data Adapter to hold the data for Recycler View
HomePageView
This associated with the view of recycler view.
Results
Conclusion
We learnt a simple application which explains the power video kit apis and showcase how easy it to have the videos running in out applications.
References