Android Question Media player load file from phone question

Discussion in 'Android Questions' started by edm68, May 24, 2015.

  1. edm68

    edm68 Member Licensed User


    I'm trying to use Erel's example from here:

    I'm trying to play a mp3 on phone already, not one included on files tab(I saw her standing there).
    I'm not sure what I'm doing wrong, tried a few options, not sure how to insert the file I want to play.
    Only thing I've changed is in Sub Activity_Create(FirstTime As Boolean)

    Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
         MediaPlayer1.Initialize( )
    'MediaPlayer1.Load(File.DirAssets, "IsawHerStandingThere.mid")     'from Erel's example
    '     /sdcard/Music/Joe Walsh/There Goes the Neighborhood/03 Down on the Farm.mp3     'file loc on phone that i try to play

    'my first attempt To load from phone sd card
    '       MediaPlayer1.Load(File.DirDefaultExternal,/Music/Joe Walsh/There Goes the Neighborhood/03 Down on the Farm.mp3)
         'didn't compile - undeclared var Music

    'my second attempt
         MediaPlayer1.Load(File.DirDefaultExternal,"Down on the Farm.mp3")
    '     compile okay but when run
    '     gives result of:
    ' Prepare failed.:
    '     status=0x1

    End If
    'set the default value
    End Sub
    Just realized after previewing this do I need to move somewhere other than 'Sub Activity_Create(FirstTime As Boolean)'

    Thanks for any help
  2. Erel

    Erel Administrator Staff Member Licensed User

    How did you copy this mp3 file to that location?
  3. edm68

    edm68 Member Licensed User

    I think when I bought the phone I'm testing this on I transferred music thru USB cable from PC to phone.
    I also have added since original question:
    Not sure if it was needed but the same result.
  4. Erel

    Erel Administrator Staff Member Licensed User

    Make sure that the file is actually there:
    Log(File.Exists(File.DirDefaultExternal,"Down on the Farm.mp3"))
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice