The function setDataSource()
works with a url , but I need to fetch a file in my raw (for example).
I used:
Uri url = Uri.parse("android.resource://" + ctx.getPackageName() + "/" + R.raw.file);
mediaPlayer.setDataSource(url.toString());
But it does not work.