Search in sources :

Example 1 with PlaylistItem

use of com.frostwire.android.core.player.PlaylistItem in project frostwire by frostwire.

the class Librarian method createEphemeralPlaylist.

public EphemeralPlaylist createEphemeralPlaylist(final Context context, FileDescriptor fd) {
    List<FileDescriptor> fds = getFiles(context, Constants.FILE_TYPE_AUDIO, FilenameUtils.getPath(fd.filePath), false);
    if (fds.size() == 0) {
        // just in case
        Log.w(TAG, "Logic error creating ephemeral playlist");
        fds.add(fd);
    }
    EphemeralPlaylist playlist = new EphemeralPlaylist(fds);
    playlist.setNextItem(new PlaylistItem(fd));
    return playlist;
}
Also used : EphemeralPlaylist(com.frostwire.android.core.player.EphemeralPlaylist) FileDescriptor(com.frostwire.android.core.FileDescriptor) PlaylistItem(com.frostwire.android.core.player.PlaylistItem)

Example 2 with PlaylistItem

use of com.frostwire.android.core.player.PlaylistItem in project frostwire by frostwire.

the class ApolloMediaPlayer method play.

@Override
public void play(Playlist playlist) {
    List<PlaylistItem> items = playlist.getItems();
    idMap.clear();
    long[] list = new long[items.size()];
    int position = 0;
    PlaylistItem currentItem = playlist.getCurrentItem();
    for (int i = 0; i < items.size(); i++) {
        PlaylistItem item = items.get(i);
        list[i] = item.getFD().id;
        idMap.put((long) item.getFD().id, item.getFD());
        if (currentItem != null && currentItem.getFD().id == item.getFD().id) {
            position = i;
        }
    }
    MusicUtils.playAll(list, position, false);
}
Also used : PlaylistItem(com.frostwire.android.core.player.PlaylistItem)

Aggregations

PlaylistItem (com.frostwire.android.core.player.PlaylistItem)2 FileDescriptor (com.frostwire.android.core.FileDescriptor)1 EphemeralPlaylist (com.frostwire.android.core.player.EphemeralPlaylist)1