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 java.io.IOException;
import android.app.Activity;
import android.os.Bundle;
import android.media.MediaPlayer;
import android.util.Log;

public class testapp extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
 try {
     MediaPlayer mp = MediaPlayer.create(this, R.raw.bell);
     mp.prepare();
     mp.start();
 } 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> sublimeslime.com> 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. Need to know RPC design in android

Hello all,
I am very new to the android world. I am concerned about the kernel
level code in android.
I am currently looking for document on RPC(Remote procedure Call) in
android. It seems like android uses SunRPC. But I do not find any
document related to RPC.
Can any please help in finding a decent document which briefs the RPC
design in android?

Looking forward to your replies

--~--~---------~--~----~------------~-------~--~----~

2. How to build android source code and SDK correctly by cygwin?

Hi all:

    The code was downloaded successfully by cygwin. But when I make
it, the errors were as follows:
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=1.6
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=windows
HOST_BUILD_TYPE=release
BUILD_ID=Donut
============================================
build/core/main.mk:359: sdk-only: javac available.
make: *** No rule to make target `/usr/lib/tools.jar', needed by `out/
target/com
mon/docs/offline-sdk-timestamp'.  Stop.


    I can make the NDK successfully by cygwin and my tool chains are
listed in the
following:
1. gcc version 3.4.4
2. GNU Make 3.81
3. java version "1.6.0_16

Dose anyone help me?
Thanks a lot!!

Chuck

--~--~---------~--~----~------------~-------~--~----~

3. Where have all the Google employees gone?

4. Can android applications install it's shared library files(*.so) from own update server?

5. Archos 5 Android PMP

6. Remote Wipe /Hard Reset / Factory Default

7. The application android has stopped unexpectedly