androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.56k stars 373 forks source link

Seeking Improved Approach for Accessing Metadata Changes in ExoPlayer During Playback #1094

Open akhilaravind123 opened 7 months ago

akhilaravind123 commented 7 months ago

Description: I am currently working on an Android application that utilizes ExoPlayer for media playback. One of the key requirements of the project is to dynamically update the UI based on metadata changes during playback. We have an "onCue" method for Amazon IVS player for this specific requirement. I need something similar to that in ExoPlayer . I found a code snippet for doing this in ExoPlayer .

Capture

Issue: I am seeking advice and suggestions from the community about this approach, Is there any better way for accessing metadata changes in ExoPlayer during playback?

Questions: 1) Are there any best practices or examples available for accessing metadata change in ExoPlayer? 2) Any considerations or challenges I should be aware of when implementing this feature in ExoPlayer compared to AWS IVS Player?

Reference: Embedding Metadata in Amazon IVS Player: https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/metadata.html

Additional Context: Android version: Android SDK 21 or above Any relevant code snippets or resources would be greatly appreciated.

marcbaechinger commented 7 months ago

The approach with MetadataOutput.onMetadata seems to me to be the right way to do that if you want to receive proprietary ID3 tags (proprietary as in non-standard semantic like 'artist'). I don't know Amazon IVS, so I'm guessing they are using some kind of ID3 tags with content specific to their use case.

ExoPlayerImpl itself is using MetadataOutput.onMetadata(). It receives the in-band metadata and merges it with the MediaMetadata object of the item currently being played. That's probably also kind of the code sample that you are looking for. Check it out here.

My guess would be that you are looking for one of the Id3Frame types, probably TextInformationFrame, that you can find here. I think with such a stream and once having a break point in onMetadata you should be able to figure that out without me reading the AMazon docs. :)