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. Marquee Api demo

I downloaded the Android SDK 1.1 and tried to run the Marquee demo
(API Demos -> Text ->Marquee).
But the program is not working .....The text is static and does not
move :(
Did any one try this demo? And is it working??
Please help!


2. Cloud based apps

I recently saw the VP of Mobile initiatives in Google (Vic Gundotra)
touting the importance of  browser based apps on Android and other
platforms. Given the popularity if Webkit , boradband penetration in
mobile, shouldn't this be the way to go as opposed to the traditional
'client-server' type apps most of us are developing on Android?

Where do you think this development is headed?


3. Will SyncML engine be available in Android?

4. How the file is updated when I modify a default app in the Android source code?

5. help please!

6. Problem with setTheme() method

7. Dynamically loading a .jar file at Runtime