yjPlay
yjPlay copied to clipboard
Does this library support playlist mp3
hi, does this library support playlist mp3 like this?
Hello. Currently, there is no single audio encapsulation. Later versions will take into account the audio package.
hi, i applicable to that. The flow is that, you just make custom layout control view. Inside control view, you put design below there and list out just put recycleview on top controller view below. Lastly, in programmatically, make control view always visible. The only things, latest current version exoplayer cannot support to get each timeline as show in the picture (4.38). Hope, if anyone want to refer this as solution for their problem.
Oh I see, the duration is 4.35, not 04.35. Is my understanding right?
duration is hard cord because i still cannot how to find each timeline for mp3 list music. The developer said that they will enhanced but not know when they will update.
The duration of the MP3 list can be obtained by interface and formatted by itself, if item is playing.
.addUpdateProgressListener(new AnimUtils.UpdateProgressListener() {
@Override
public void updateProgress(long position, long bufferedPosition, long duration) {
// // Log.d(TAG,"bufferedPosition:"+position);
// Log.d(TAG,"duration:"+duration);
})
Realization of monitoring,Item modifies the duration being played.
the problem is that, before load all music file I create array list which contain music title and time(hardcord). Then, i read list file directory music get name of files, url uri file list then concatenate media source. The problem current version 2.8.2 not applicable to get one by one time from file music that i extract from the directory.
Hello, recommend using content-provider to query your MP3 file information. doc
Cursor cursor = query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
歌曲ID:MediaStore.Audio.Media._ID
Int id = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media._ID));
歌曲的名称:MediaStore.Audio.Media.TITLE
String tilte = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE));
歌曲的专辑名:MediaStore.Audio.Media.ALBUM
String album = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM));
:MediaStore.Audio.Media.ARTIST
String artist = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST));
:MediaStore.Audio.Media.DATA
String url = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA));
:MediaStore.Audio.Media.DURATION
Int duration = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION));
:MediaStore.Audio.Media.SIZE
Int size = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.SIZE));
so this cursor come from database server or ??
content-provider get content-provider Automatic reading of native database
owh so meaning that, i retrieve all data from server first then store in database instead of reading from native exoplayer list timeline to get duration of mp3.
Yes, exoplayer acquisition is just the duration of the current MP3 player. In my development experience, the duration of audio and video is provided by the duration interface or by the local database, not by the exoplayer player. More than consumption memory. The experience is bad.
ok note. but some suggest use this way
Timeline timeline = musicPlayer.getCurrentTimeline(); int currentWindowIndex = musicPlayer.getCurrentWindowIndex(); long currentPosition = musicPlayer.getCurrentPosition(); long totalTime = 0; Timeline.Window tmpWindow = new Timeline.Window(); if (timeline != null) { for (int i = 0; i < timeline.getWindowCount(); i++) { long windowDuration = timeline.getWindow(i, tmpWindow).getDurationMs(); timeVideo.setText(String.format("%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(currentPosition), TimeUnit.MILLISECONDS.toSeconds(currentPosition) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(currentPosition)))); //totalTime += windowDuration; //if (i < currentWindowIndex) { // currentPosition += windowDuration; //} } }
However, timeline second mp3 is zero instead of to show one by one.