Play MP3 from SD Card Problem

ringram2077

New Member
Licensed User
Longtime User
Hi all,
Noob here on the forum. Been gettign feet wet with B4A. I have a little experience with VB6 so a lot is familiar. Problem is I am playing around with MediaPlayer and for the life of me cannot load a mp3 from the sd card on my Samsung Charge. I have played a file from DirAssets no problem but no luck with DirRootExternal or DirDefaultExternal. Here is the section of interest.

B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
Timer1.Initialize("Timer1", 1000)
End If
Activity.LoadLayout("exp_layout1")
Label1.Text = "UncleRich"
MediaPlayer1.Initialize( )    
MediaPlayer1.Load(File.DirRootExternal,"/music/track1.mp3") 'does no work
End Sub
I have tried a number of different combination but always get "Prepare Fails" java message when the code runs.
I have searched the forum and seen several similiar issues but no solution that has worked for me.

This code returns /mnt/sdcard/Android/data/find.filepath/files
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
label1.Text = File.DirDefaultExternal
End Sub

Probably something simple but after several hours struggling with this I must ask for help.
Thanks
 
Last edited:

ringram2077

New Member
Licensed User
Longtime User
Thanks for the reply Margret.
I tried the that path and it too results in "Prepare Failed". I searched around and found a thread that seems to indicate that Samsung is doing something odd with the external storage. Maybe you can see something there that might help.

Mono for Android - detect SD Card path?
 
Last edited:
Upvote 0
Top