AMP Android SDK: ID3 Tags integration

Document created by Orlando Sanchez Martinez Employee on Dec 28, 2016Last modified by Herberth Alvarado on Apr 9, 2017
Version 5Show 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 ID3TagSample Android Studio sample project in the release package.
To integrate the plugin into your app, you need to:

 

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

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

import com.akamai.id3tags.ID3TagData;
import com.akamai.id3tags.ID3TagEventListener;
import com.akamai.id3tags.ID3TagExtractorMessageHandler;

 

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

private ID3TagExtractorMessageHandler mId3TagExtractorMessageHandler;

 

4) Initialize that object, on the onResourceReady() method from the VideoPlayerContainerCallback:

@Override
public void onResourceReady(MediaResource mediaResource) {
    resource = mediaResource;
      .
      .
      .
    mId3TagExtractorMessageHandler = new ID3TagExtractorMessageHandler();
    mId3TagExtractorMessageHandler.setVideoPlayerView(mVideoView);
    mId3TagExtractorMessageHandler.addEventListener(MainActivity.this);
      .
      .
    mVideoView.play(resource);
}

 

5) Make your Activity implement the ID3TagEventListener. This interface has a single method:

public boolean onFoundID3TagData(ID3TagData data);

 

6) Implement the onFoundID3TagData() method, to receive the ID3 tags and handle them in your own custom way:

 

@Override
public boolean onFoundID3TagData(ID3TagData data) {
    String id3Tag = data.getText();
    Log.i(LOG_TAG, id3Tag);
      .
      . 
    return true;
}

 

 

If you have any question or comment, reach out to us via email: amp-sdk-support@akamai.com

1 person found this helpful

Attachments

    Outcomes