Vatsal Shah Vatsal Shah - 3 months ago 59
Android Question

How to run .pls file in android app using mediaplayer?

I have one

.pls
file which is online but when I am creating media player in my code, it gives error.

MediaPlayer mp = new MediaPlayer();
mp=MediaPlayer.create(getApplicationContext(),Uri.parse("PLS file link"));
mp.prepare();
mp.start();


Please help me to run
.pls
file.

Answer

The Android MediaPlayer class can not process .pls files directly - it can only play individual media files.

If you want to use a .pls file you will need to download it, read the contents in code and pass each of the URLs to the MediaPlayer one at a time.

Comments