Simple Issue with Audio

All your problems with Audio, Video and Images.

Simple Issue with Audio

Postby CyberCode » Sat Nov 27, 2010 8:46 am

I have been trying to learn android programming so i am still a bit new, i am also new to this site so please bare with me.

I am trying to make a very simple mp3 player for learning purposes and i seem to have it for the most part, it locates the mp3 files on the /sdcard/ and creates a playlist out of them, the problem that i am having is that its not making any sound, not playing them. i have called
Code: Select all
MediaPlayer mp = new MediaPlayer();
try{
    mp.setDataSource(PathToSong);
}catch(IOException io){
   return;
}
mp.prepare();
mp.start();

but its simply not working, not crashing! but not working. here is the actual code from the Play Button. tlist is File[] that holds all of the mp3 file names, uniIndex is just an index to keep track of what song its on.
Code: Select all
View.OnClickListener PlayAction = new View.OnClickListener()
   {
      @Override
      public void onClick(View v)
      {
         if(isLocked)
         {
            DebugToast("Update List\nNo Songs Found");
            return;
         }else if(mp.isPlaying()){
            DebugToast("Currently Playing");
            return;
         }else{       
            try{
               if(mp == null)
               {
                  DebugToast("mp = null");
                  return;
               }
               mp.reset();
               mp.setDataSource("/sdcard/" + tlist[uniIndex].toString());
               mp.prepare();
            }catch(IOException io){
               return;
            }
            mp.start();
         }
      }
   };

Thank you for any help in advance!
CyberCode
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Nov 27, 2010 8:36 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 8 guests