AMP Android SDK: CEA-608 Close Captions integration

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


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 AMPCaptioningSample Android Studio sample project in the release package.
To integrate the plugin into your app, you need to:


1) Add the amp-closed-captions.jar to your project's /libs folder.

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

import com.akamai.captioning.CaptionComponent;
import com.akamai.captioning.CaptioningWrapper;


3) Add an object of the CaptionComponent type in your Activity's members:

private CaptionComponent captionComponent;
private CaptioningWrapper captioningWrapper;


4) The CaptionComponent is of the android.widget.RelativeLayout type, so it must be declared in the Activity's .xml in the /layout folder:

   android:clickable="false" />


5) To initialize the CaptionComponent, add this to your Activity's onCreate() method:

captionComponent = (CaptionComponent) rootView.findViewById(;


6) Initialize the CaptionComponent and CaptioningWrapper objects, on the onResourceReady() method from the VideoPlayerContainerCallback:

private void createCaptions(){
   captioningWrapper = new CaptioningWrapper(captionComponent);


   //Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/Arial Black.ttf");




If you have any question or comment, reach out to us via email:

1 person found this helpful