These phones are killing me with exceptions while running the same
trivial code that works on other phones, in which I play a short mp3
file packed as a raw resource.  This is the only MediaPlayer use in my
app, so I am sure not exhausting any limits on number of such items.

Here is the code that works on most Android phones and not on at least
SOME Hero/Eris.
What can/should I be doing differently?

// often (always?) returns null on Hero/Eris when called from within
my app's main activity
MediaPlayer mp = MediaPlayer.create(this, resId);
mp.start(); // this will just crash on a Hero/Eris, as mp will be null

// ditto... returns null and I do not know why
mp = MediaPlayer.create(getBaseContext(), resId);

**I have no Hero or Eris on which to test**, and so further detail is
difficult to obtain.

I also tried the following code after some other dev opined that Hero/
Eris had trouble playing audio resources.  I copy the resource out to
a file and then just get another error.

mp = new MediaPlayer();
copyResourceToFile(resId, "foo.mp3");
mp.setDataSource(fname);
mp.prepare();   // fails on java.io.IOException: Prepare failed.:
status=0x1

Could this be an unsupported codec (it's a 4 second mp3 for crying out
loud, exported from Audacity)?  Should I try a PCM encoded wav file?

I would love some data from those who have actually done this on Hero/
Eris.  I suspect any "well, this should work" answers will fail just
as mine have.

tone

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to