AMP Android SDK: Close Captions integration (WebVTT and CEA-608)

Document created by Orlando Sanchez Martinez Employee on Dec 28, 2016Last modified by Orlando Sanchez Martinez Employee on Dec 13, 2017
Version 5Show 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;


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

private CaptionComponent captionComponent;


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 that object, on the onResourceReady() method from the VideoPlayerContainerCallback:

private void initCaptions(){

   //External VTT file, for media assets with no integrated captions
   captionComponent.loadExternalVTTResource("English", "en", CAPTION_ASSET_URL);




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

1 person found this helpful