On Nov 16, 3:37 pm, Cool Frood <[EMAIL PROTECTED]> wrote:
> On Nov 16, 10:49 am, Cool Frood <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to write play a sound once using a MediaPlayer object:
>
> > MediaPlayer p1 = MediaPlayer.create(ctx, R.raw.tick);
> > p1.setLooping(false);
> > p1.start();
>
> > R.raw.tick is a short OGG file. This always causes the MediaPlayer to
> > loop. Even if I use an OnCompletionListener, it is never invoked. Is
> > this a MediaPlayer bug or am I doing something wrong here?
>
> Update: Yes, there seems to be a bug with playing OGG files using the
> MediaPlayer. They loop continuously. I switched to WAV files instead
> and they work fine.
Update: I dug deeper into the Android source code and realised that
OGG files that contain ANDROID_LOOP=true in their metadata will loop,
no matter what value you use for setLooping(). Technically, it's not
a MediaPlayer bug, but it still seems like a backdoor undocumented way
of causing audio files to loop. It should at least be documented in
the SDK documentation.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---