-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iterate remote urls and get mp3 metadata #7460
Comments
I think this is expected, because you are getting the group of tracks for just the first window (corresponding to the first song/playlist item). Within the one track group there should be one track with an audio format. The terminology may be confusing because on a music album you would talk about tracks played in sequence, whereas when you query current tracks in ExoPlayer you get the tracks associated with one playlist item (which could include audio, video, subtitles, etc.). If you want to get the format for each playlist item in turn, you can issue seeks to go from one window to the next, like:
Not at the moment. This would be covered by the feature request in #3609. |
Hello,
I have a number of links to mp3's:
data = {
"http://url1.com/file1.mp3"
"http://url1.com/file2.mp3"
"http://url1.com/file3.mp3"
"http://url1.com/file4.mp3" }
I'm trying to get tracks metadata, as it was explained here in other issues:
(Note: I DON'T WANT TO PLAY TRACKS, I NEED ONLY COLLECT METADATA (ARTIST, GENRE, ALBUM ART))
1) first: make ConcatenatingMediaSource:
mConcatMediaSource=new ConcatenatingMediaSource();
for(int i = 0; i < data.size(); i++) {
mediaSource = new ExtractorMediaSource(data[i],
HttpDataSourceFactory,
extractorsFactory,
mainHandler,
null);
mConcatMediaSource.addMediaSource(mediaSource);
}
2) second: override onTracksChanged:
@OverRide
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
for (int i = 0; i < trackGroups.length; i++) {
TrackGroup trackGroup = trackGroups.get(i);
Log.d("trackGroup len: ",Integer.toString((trackGroup.length)));
for (int j = 0; j < trackGroup.length; j++) {
Metadata trackMetadata = trackGroup.getFormat(j).metadata;
if (trackMetadata != null) {
// We found metadata. Do something with it here!
Log.d("onTrackMeta: ",trackMetadata.toString());
} } }
But this method Log prints metadata ONLY for 1-st track, beacuse trackGroup.length is always = 1 (very strange :().... What am I missing or doing wrong?
I don't know what to do, I have seacrched and read many issues, but didn't found simple description or code , how can I iterate all entries of mConcatMediaSource. How to deal with TrackGroupArray trackGroups, TrackSelectionArray trackSelections ?
Does Exo have somthing like MediaMetadataRetriever().setDataSource(link) and extractMetadata?
The text was updated successfully, but these errors were encountered: