AMP Android SDK: Decoding Modes

Document created by Orlando Sanchez Martinez Employee on Dec 22, 2016Last modified by Herberth Alvarado on Apr 9, 2017
Version 7Show Document
  • View in full screen mode

The best practice is not to set any decoding mode, since the AMP SDK automatically selects the appropriate decoding method for playback, according to the stream and the device used.

 

However, if you need to manually select one of the available modes (for testing, compatibility or other reasons), use the following line:

videoPlayerContainer.setDefaultMode(playerMode);

 

The videoPlayerContainer.setDefaultMode() method must be invoked before the videoPlayerContainer.getVideoPlayer() method, in the first lines of the onResourceReady() method of the callback.

 

playerMode should be one of the following constants (corresponding to the decoding methods detailed below):

  • VideoPlayerContainer.MODE_AUTOMATIC
  • VideoPlayerContainer.MODE_EXO
  • VideoPlayerContainer.MODE_HARDWARE_ADVANCED
  • VideoPlayerContainer.MODE_NATIVE_BASIC
  • VideoPlayerContainer.MODE_HARDWARE
  • VideoPlayerContainer.MODE_SOFTWARE

 

 

Decoding modes

 

The decoding modes available in the Android SDK are:

 

EXO mode

  • It's the default mode of the player.
  • Used for HLS, DASH, Smooth Streaming and PMD playback.
  • The decoding job is done by our own modified version of the ExoPlayer Library.
  • This library has been integrated in a way that won't collide or have any problem with any other ExoPlayer version your app might be using.
  • This is the recommended mode for most scenarios.
  • It's compatible with Android OS 4.1 and above.

 

Hardware Advanced mode

  • It’s AMP's own HLS decoding mode.
  • It is fully functional in all our versions, but it's deprecated now.
  • It provides fast startup times, hardware acceleration and support for automatic bitrate switching (adaptive bitrate).
  • Available for devices Android 4.0 and above.

 

Native basic mode

  • Using this mode, the Android SDK will directly use the native player implemented by Android.
  • It is a wrapper to the system's own multimedia playback capabilities.
  • Due to the different implementations of the native player in the different versions of Android, this mode will not be available on multiple devices.
  • Furthermore, this mode presents some restrictions, due to the fact the Android OS doesn't report back to the SDK some data that is available in other modes.

 

Hardware decoding

Android SDK will use the H.264 decoder chipset present in any Android device (version 1.6 and on) for decoding video/audio of the stream.

The quality offered by this method is much better than the one you can get using software based decoding, although this method has the same limitations of the H.264 decoding chipset: not supporting other H.264 profiles than Baseline. Automatic bitrate switching is not supported in this mode.

 

To enable Hardware decoding, the com.akamai.media.hls.AkamaiHLSService service must be declared in the Android Manifest file inside the application section:

<service android:name="com.akamai.media.hls.AkamaiHLSService" />

 

Software decoding

Android SDK will use software based codecs for decoding the video/audio of the stream, on older devices (compatible with Android 1.6 and above).

Since it's using software, CPU consumption will be higher than when using hardware based decoding.

As an advantage, this method is free of any restriction of the device regarding video encoding limitations. Automatic bitrate switching is supported.

 

Automatic mode

This mode follows the next logic to determine the decoding method to be used:

  • For MPEG-Dash, SmoothStreaming, or PMD: EXO mode is selected
  • For HLS
    • For Android OS 4.1 or above: EXO mode is selected.
    • For Android OS 4.0 or above: Hardware Advanced mode is selected.
    • If it’s an Android OS below 4.0:
      • If the number of cores inside the CPU of the device is 2 or higher: Software mode is selected
      • If the CPU of the device contains a single core: Hardware mode is selected.
1 person found this helpful

Attachments

    Outcomes