4
\$\begingroup\$

I am designing my first android game, and this is my first question on gamedev.stackexchange.

My MediaPlayer is null on my genymotion emulator, but is working fine on my actual android device. I have been looking for an answer to why the MediaPlayer only works on certain devices for a very long time now, but with no luck. Here is the code for the MediaPlayer, it runs in a service with a timer:

if (millisUntilFinishedRounded == 10000) { //TEN SECONDS
  MediaPlayer ten = MediaPlayer.create(TwentySeconds.this, R.raw.tenmoreseconds);
  try {
    ten.start();
  }catch(NullPointerException e){
    Log.v(TAG, "NULL");
  }
}

I am getting the log saying Null. I am lost at this point; why does it work on only some devices? Could this be a problem with the audio format or something?

\$\endgroup\$

0

Browse other questions tagged .