Play files from explorer (currently only if the matching song is in the MediaStore)

This commit is contained in:
Karim Abou Zeid 2015-07-10 23:32:29 +02:00
commit d8c7af3e09
2 changed files with 15 additions and 2 deletions

View file

@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.media.audiofx.AudioEffect;
import android.os.IBinder;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
@ -305,6 +306,17 @@ public class MusicPlayerRemote {
}
public static void playFile(String path) {
//TODO
if (musicService != null) {
ArrayList<Song> songs = SongLoader.getSongs(SongLoader.makeSongCursor(
musicService,
MediaStore.Audio.AudioColumns.DATA + "=?",
new String[]{path}
));
if (!songs.isEmpty()) {
openQueue(songs, 0, true);
} else {
//TODO the file is not listed in the media store
}
}
}
}