Hi all,

I'm trying to play a looping background track in my app and it doesn't
loop.
The track starts playing and once it reaches the end all I hear is a
weird crackly sound for a split second and then nothing else.
Logcat doesn't show anything useful at the time. No errors/warning/
exceptions/etc.

Here's how I'm doing it...
During initialisation I call this:

    public static MediaPlayer MEDIA_PLAYER;

        private static boolean initMusicPlayer(InGameView p_inGameView)
        {
        MEDIA_PLAYER = MediaPlayer.create(p_inGameView.getContext(),
R.raw.bgmusic);
        MEDIA_PLAYER.setOnErrorListener(
                                new MediaPlayer.OnErrorListener() {
                                public boolean onError(MediaPlayer p_mp, int 
p_what, int
p_extra)
                                {
                                        Log.e("MEDIA_PLAYER", "ERROR: 
MediaPlayer: (" + p_what +")
with extra (" + p_extra +")" );
                                        return false;
                                }
                            });

        MEDIA_PLAYER.setLooping(true);

                return true;
        }

Then, in the surfaceChanged of my InGameView (i.e. when things are
good to go), I call

      MEDIA_PLAYER.start();

Can you guys see anything wrong with the above? Any ideas what could
be causing this?
All help greatly appreciated.

cheers,
kk.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to