How to play mp3 file from SD card?

All your problems with Audio, Video and Images.

How to play mp3 file from SD card?

Postby appomaticsoftware » Sun Apr 18, 2010 3:16 am

I'm having an issue playing an mp3 in my app. The mp3 is located on the SD card. I'm using the following as my string.
Code: Select all
String path1 = Environment.getExternalStorageDirectory() + "/music/track3.mp3";

mediaplayer.setDataSource(path1);


the error seems to be on the mediaplayer.prepare(); method as the app doesn't crash if .prepare(); isn't there.
appomaticsoftware
Freshman
Freshman
 
Posts: 3
Joined: Thu Mar 11, 2010 9:05 am

Top

Postby Th3sandm4n » Mon Apr 19, 2010 5:30 am

You tried passing it in any of the other types of parameters it takes? (FileDescriptors,Uris,etc)?

I remember messing around with this for a url and couldn't get it to work either, I'm guessing probably the same tiny reason you aren't. I didn't really investigate since I was just messing around.
Th3sandm4n
Freshman
Freshman
 
Posts: 8
Joined: Wed Mar 10, 2010 8:53 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 15 guests