Problem playing audio on android

by Alex Coventry » Mon, 22 Feb 2010 15:03:30 GMT

Sponsored Links
 The following code crashes when I try to play it on my droid. The
error message given in the log is "Command PLAYER_INIT completed with
an error or info PVMFErrNoResources."  Then an IOExecption is raised.
There is a file "res/raw/bell.mp3" in my project directory, which I
assume corresponds to R.raw.bell in the code below. I am building with
"ant debug". In case it's relevant, when I created the project
directory with "android create", I set the target number to 4,
corresponding in my system to "android 2.0."

What am I doing wrong, here?

import android.os.Bundle;
import android.util.Log;

public class testapp extends Activity
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState)
 try {
     MediaPlayer mp = MediaPlayer.create(this, R.raw.bell);
 } catch (IOException e) {
     Log.v(getString(R.string.app_name), e.getMessage());



Problem playing audio on android

by OldSkoolMark » Mon, 22 Feb 2010 22:34:06 GMT

 Try putting the start() call in onResume().


Sponsored Links

Problem playing audio on android

by Alex Coventry » Tue, 23 Feb 2010 23:25:02 GMT

 OldSkoolMark <mark <at>> writes:

Thanks for the suggestion.  Turned out the mp3 file I was testing with is
unplayable on android.  Transcoding with ogg and replacing fixed the problem. 
On the other hand, no other android apps were able to play the file.  The file
was generated from a WAV using LAME, and is playable with mplayer.)


Other Threads

1. Opengles 2.0 question - texture map manipulation

Is there an efficient way to modify a texture map that is bound to an
object?  I would like to draw graphics on a bitmap texture that would
update on an object automatically.

Any insight would be appreciated.



2. Gallery as a horizontal list

The gallery widget is almost the right thing for a horizontal list. It
works with the same adapter pattern as ListView.  But Gallery is
pretty insistent about keeping the selected item in the center of the
visible area.  Has anybody tried to modify it so it displays the first
item on the left instead of centered?  Or is there another or better
way to get a horizontal scrolling list?


3. Cannot Debug Andriod Service

4. Unable to load default SVN Client

5. Animation stops timer (newbie alert!)

6. Android Tablet yang sudah tersedia di jakarta apa saja?

7. about ProGuard