Application Development Using NexStreaming NexPlayer SDK

Updated on 03-Jul-2015

Introduction

NexStreaming is a global mobile software company with headquarters in Seoul, Korea and branches in Spain, United States, Japan, and China. Its most popular product, NexPlayer* SDK, is a player SDK used by some of the most famous video service providers integrated into mobile applications. The player is compatible with all the leading DRM technologies in the industry. Moreover, it can be combined with other complementing technologies such as advertisement insertion, audience measurements, or audio enhancements. NexStreaming NexPlayer SDK provides audio and video decoding and playback services. Application developers can use the SDK to build custom efficient multimedia players quickly. NexPlayer SDK is reliable and robust and has proven to be compatible with international standards. This paper describes how to create an x86 player app using the NexPlayer SDK.

Platform Compatibility

The NexPlayer SDK is optimized for x86, so it is fully supported by x86 devices. NexPlayer SDK supports the following:

  • Android* 1.6 or above
  • mp4, 3gp, avi, asf, piff video file formats
  • HTTP Live Streaming version 5.0, 3GPP Progressive Download, AES128, HTTPS protocols, h.264, AAC, AAC+, eAAC+ codecs. Both software and hardware codecs are supported by the SDK.
  • .smi, .srt, .sub, 3GPP timed text, TTML closed captions (PIFF/CFF only), CEA 608 and CEA 708 closed captions, and Web Video Text Tracks (WebVTT)

 

How to create an x86 player app using NexPlayer SDK

You need to request the SDK from NexStreaming http://www.nexstreaming.com/downloads-sdk. Once you downloaded the SDK and the demo app, the optimization for the Intel® chipsets will be automatically included. Full documentation is included with the SDK. Refer to the SDK documentation and samples to select the APIs appropriate for your application. App development using the SDK is very easy and straightforward. You can use sample code as a guide. It takes about one hour to develop a complete app with NexPlayer SDK.

To integrate NexPlayer SDK into an x86 Android app and ensure the best experience with the NexPlayer SDK on Intel® devices, you need to perform the following simple steps.

  • Copy the libs contained in the SDK/libs/ folder into the assets/x86 folder of your project.
  • Copy the libs contained in the SDK/libs folder into the libs/x86 folder of your project.
  • Copy the source files contained in the SDK/src folder into the src/com/nexstreaming/nexplayerengine folder of your project.

The NexPlayer SDK will detect that change and use those libraries to take advantage of the Intel resources. Once all libraries are in these directories, switch between ARM and x86 version of an app is automatic and handled by the SDK. If you want to integrate a newer version of NexPlayer SDK, the only thing you need to do is to overwrite the library files above.

NexPlayer SDK includes a large number of libraries including DRM libraries. These libraries are in the app/assets/x86 directory. Required libraries consist of engine, decoders, and the rendering layer:

  • libnexalfactory.so
  • libnexadaptation_layer_for_dlsdk.so
  • libnexralbody_audio.so
  • libnexralbody_video_opengl.so
  • libnexral_nw_ics.so
  • libnexral_nw_jb.so
  • libnexcal_oc_ics.so
  • libnexcal_oc_jb.so
  • libnexcralbody_mc_jb.so
  • libnexcal_in_aac_x86.so
  • libnexcal_in_mp3_x86.so
  • libnexcal_in_amr_x86.so

Some library names contain abbreviations “ics” for Ice Cream Sandwich and “jb” for Jelly Bean. If your app only supports certain version(s) of Android, you can remove the libraries for the unsupported version(s) of the OS.
The libraries that provide support for codecs are:

  • libnexcal_h364_x86.so – video lib for H.264
  • libnexcal_aac_x86.so – audio lib for AAC, AAC-Plus, and HE-AAC
  • libnexcal_mp3_x86.so – audio lib for MP2 and MP3

The following libraries support text captions:

  • libnexcal_3gpp_x86.so – for 3GPP timed text captions
  • libnexcal_closedcaption_x86.so – for CEA 608 and CEA 708 closed captions
  • libnexcal_ttml_x86.so – for TTML (CFF) timed text captions
  • libnexcal_webvtt_x86.so – for WebVTT text tracks

To reduce the size of the app, include only the libraries that you need for your app.
The libraries from app/libs/x86 need to be loaded in InitManager() in Java* source code for the application file. For example, for “NexHDSample” add the corresponding x86 library into app/src/NexHDManager.java in initManager():
System.loadLibrary("NexHTTPDownloaderSample_jni");

How to display your x86 app’s video on the screen using the SDK

There are two ways to display a video using NexPLayer SDK: NexVideoRenderer and the OpenGL* renderer. NexVideoRenderer is the recommended way to display video. NexVideoRenderer abstracts the complexities of surface handling and video rendering tasks by choosing the most appropriate renderer based on the device and version of the OS. To implement NexVideoRenderer, do the following:

1. Pass in a context (android.content.Context) to the constructor.
2. Set up listeners (NexPlayer.IListener and NexPlayer.IVideoRendererListener).
3. Create an instance of NexPlayer.
4. Perform the necessary setup for NexPlayer (NexPlayer.setNexALFactory and NexPlayer.init).
5. Call init with the NexPlayer instance (NexVideoRenderer.init).
6. Add the NexVideoRenderer instance as a view to your layout.
A complete example of this renderer is in NexPlayerSample/src/com.nexstreaming.nexplayerengine/NexVideoRenderer.java.

Live Streaming

HTTP Live Streaming supports multiple audio and video streams. setMediaStream() API allows these streams to be selected from the user interface while content is being played. This is supported by the SDK and is mentioned in this paper just for your information. Three possible use cases are available:

1. A variant playlist with alternative audio. In this case video and audio can be selected independently.
2. A variant playlist with alternative video. Here each track contains both audio and video, but alternative video streams are available (for example, different camera angles or views of the same content).
3. A combination of a variant playlist with alternative video and audio. This use case is a combination of the above cases, where a main video stream provides video tracks at different bitrates but INCLUDES the same audio, and separate audio tracks are available for optional language selection.

PnP Analysis of x86 NexPlayerDemoApp

In the following analysis I evaluated launch and idle as well as playback of local mp4 files and sample streams of a sample app (“NexPlayerDemoApp”) developed using NexPLayer SDK. The analysis was performed with the VTune™ analyzer for Android and Intel® SoC Watch on an Intel® Atom™ processor-based tablet Z3740 @1.6 GHz with Intel® HD Graphics (Gen 7) and Wi-Fi* connected, on Android 4.4.2 (KitKat).

Intel® Atom™ processor-based tablet Z3740 Baseline

NexPlayerDemoApp at Idle

High C0 times on the Intel® Atom™ processor-based tablet Z3740 during the application idle will result in increased power consumption, but this is not the case with NexPlayerDemoApp. The numbers are very close to Z3740 baseline.

NexPlayerDemoApp at Launch

The numbers are very close to Z3740 baseline.

Video Playback

During video playback, the x86 version of NexPlayerDemoApp utilizes an average of 33% of the CPU. The activity does not show abnormalities and is consistent with the core total.

Live Streaming

During live streaming, the x86 version of NexPlayerDemoApp utilizes an average of 25% of the CPU. The activity does not show abnormalities and is consistent with the core total.

Battery Consumption

x86 NexPlayerDemoApp utilizes ~3.8W of power during the combination of live streaming (taking the majority of time), video playback, and a very short idle in x86 version.

Conclusion

Developing apps with the NexPlayer SDK is fast and easy and proves to be efficient with low power utilization on x86 mobile devices.

For more such Android resources and tools from Intel, please visit the Intel® Developer Zone

Source: https://software.intel.com/en-us/articles/application-development-using-nexstreaming-nexplayer-sdk

Connect On :