AMP Android SDK: Mobile UI integration

Document created by Jason Gamboa Employee on Jan 6, 2017Last modified by Jason Gamboa Employee on Apr 5, 2017
Version 4Show Document
  • View in full screen mode

Prerequisite

The rest of this guide assumes you have successfully integrated AMP's Core (you are able to play back a video). 

 

Getting started

For reference, check the AMPSampleUI Android Studio sample project in the release package.
To integrate the plugin into your app, you need to:

 

1) Add the amp-ui-mobile.aar to your project's /libs folder.
 

2) Add the following line to the runnable module's build.gradle file:

compile(name:'amp-ui-mobile', ext:'aar')

2) In the Activity where playback is handled, import the following Java packages:

import com.akamai.uimobile.listeners.IMediaPlayerControllerListener;
import com.akamai.uimobile.media.MediaPlayerController;

3) Add an attribute type MediaController as follows:

private MediaPlayerController mMediaPlayerController;

4) Add a UI Widget type MediaPlayerController to the activity's xml layout as follows:

<com.akamai.uimobile.media.MediaPlayerController
    android:id="@+id/playerControls"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"/>

5) Create the instance of the Controller based on the xml as follows:

mMediaPlayerController = (MediaPlayerController) findViewById(R.id.playerControls);

6) On the onResourceReady() callback, set the VideoPlayerView object to the MediaPlayerController as follows:

mMediaPlayerController.setVideoPlayerView(mVideoPlayerContainer);
2 people found this helpful

Attachments

    Outcomes