Search code examples
javaandroidid3http-live-streaming

Android extracting id3 tag information


I have a HLS stream which I am displaying using the native android media player. I need to be able to extract id3tags that are pushed through the stream every 30 seconds. I have had a good dig around the internet and have not found a viable method for doing this.

I did find something called MediaPlayer.OnTimedMetaDataAvailableListener but this is only available on sdk 23 and I need to support down to 14. Has anyone managed to extract these tags from a HLS stream on android? Or does anyone have any idea about how to go about it?


Solution

  • This is not possible yet using the standard MediaPlayer. According to the Android Developer API Guides, it is recommended to use the ExoPlayer when utilizing features such as id3 tag reading of HLS. There is a great demo on GitHub to help you get started.You basically create a Player and add a listener to it:

    player.setMetadataListener(this);