AMP Android SDK

AMP Basic Integration

The following document guides you through the basic steps of AMP Basic Integration.

Deprecation notice

This module has been deprecated, and the use of the AmpPlayer module is recommended now.

For legacy reasons or for very specific use cases, you would still need to use this module. Reach out to us at with any questions or concerns.


The Android AMP SDK is a set of tools that allows app developers to implement video playback capabilities natively, for any Android based device (mobile phone, tablet or TV).

It provides a very easy integration process and offers several advanced functionalities, such as Video and Audio playback for PMD, VOD and Live videos on different formats like HLS, DASH, SmoothStreaming, MP4, MP3, and others.

The core functionality of the player is multimedia playback, however, there is also a set of modules that include Captioning, UI Controls and several different Ads and Analytics providers.

Getting Started

This is a basic guide to integrate AMP on any Android application. The end result will be a video playing on your sample app. It won’t have any UI controls, as that is a separate module.


The rest of this guide assumes that the app developer who is integrating AMP has a working Android Studio environment; that is, they can run a “Hello World” sample on their device or emulator. It is recommended that uses the latest Android APIs.

It is also assumed that you have already received an Android AMP SDK license from Akamai. If not, reach out to us at


There are two main AMP distributions:

  • Standard: includes basic playback, captions and UI only
  • Premier: includes the ads and analytics plugins

Download the .zip package and extract the contents. This package includes several Android Studio samples. You can use your target plugin sample as base.

The rest of this guide uses the AMPSample as base.

  1. On the /modules/Core/libs folder, you can find the amp-core.jar. Copy it into the libs folder of your project.

  2. Add the VideoPlayerContainer object in your Activity’s layout as following (attributes like width, height, paddings, margins, etc; are modifiable as any other UI component in Android):

    android:layout_gravity="center" />
  1. In the onCreate() method of your Activity, get a reference to the VideoPlayerContainer object. Register the callback for playback and prepare the URL to be played:
protected void onCreate(Bundle savedInstanceState) {
    mVideoPlayerContainer = (VideoPlayerContainer) findViewById(;

With this callback, the SDK converts the URL of a stream into a

  1. In order for the callback registering to succeed, the activity must implement the
    public class MainActivity extends Activity implements VideoPlayerContainer.VideoPlayerContainerCallback {
  2. For the activity to be a VideoPlayerContainerCallback, it has to implement three methods: onVideoPlayerCreated(), onResourceReady() and onResourceError():
public void onResourceReady(MediaResource mediaResource) {

public void onVideoPlayerCreated() {

public void onResourceError() {

On the onResourceReady() method, use the play(MediaResource resource) method of the VideoPlayerView object to start playing a stream; use playAudio(MediaResource resource) for audio-only streams.

  1. MediaResource Object: In order to play a video or an audio using AMP, you need to provide a MediaResource object as shown in the previous steps. This object is a representation of a Media Resource precisely, it contains everything the player needs to start the playback, stream URLs, titles and subtitles, captions, poster image (if provided, etc).

The player is going to provide this object to you:

public void onResourceReady(MediaResource mediaResource) {
    resource = mediaResource;
    mVideoPlayerView = mVideoPlayerContainer.getVideoPlayer();
    mVideoPlayerView.setLogEnabled(true);, mCurrentPosition);

However, if you want to manually provide any of these attributes, you can modify this object to do so.

Android lifecycle

public void onResume() {
    if (videoPlayerView != null) {

public void onPause() {
    if (videoPlayerView != null) {

protected void onDestroy() {
    if (videoPlayerView != null) {

If you have further questions or comments, reach out to us via