Loading...
Logo
Processing Forum
okay I currently have a little diddy that goes a bit like this:

Copy code
  1. MediaPlayer mediaPlayer = new MediaPlayer();
  2. assetManager = this.getAssets();

  3. public void buildMediaPlayer()
  4.  {
  5.    try {
  6.      AssetFileDescriptor fd = assetManager.openFd("songTitle.ogg");
  7.      mediaPlayer.setDataSource(fd.getFileDescriptor(), fd.getStartOffset(), fd.getLength());
  8.      mediaPlayer.prepare();
  9.   } 
  10. catch (IOException e) {
  11.     print("OOOOPPPPPPPPPPPPPPPPPPPSSSSSSSSSSSSSSSS");
  12.     e.printStackTrace(); 
  13.   }
  14.  }
and although it builds properly the program will not open on the phone because of a null pointer error.
interestingly it doesnt pint OOOOPPPPPSSS in the terminal, and my song file is right there in the data folder waiting to get copied over to /assets. 
So ive read up a bit on alternate ways to declare the datasource using files stored in res/raw, but i dont know enough to figure out how to set that up easily.

anyone got any ideas?

Replies(2)

Have you tried APMediaPlayer? i was having some problem too with audio managent in android, but i solve it with this solution


I bought an logitech MK200 media desktop from "http://www.thevaluestore.in/supershop/Logitech-MK200-Media-Desktop".The things you do most are right at your fingertips with one-touch controls for instant access to play/pause, volume, mute, and the Internet.  The bold, bright white characters make the keys easier to readperfect for those with less-than-perfect vision. Theyre less likely to wear off, too. Liquid drains out of the keyboard, so you dont have to worry about ruining your investment with accidental spills. Sturdy, adjustable tilt legs. Plug-and-play USB connection.