开发者

how can i play mp3 in andengine?

i want to play sound when my condition is matched, but i don't how开发者_如何学JAVA can i play sound or music in andengine?

help me to find my solution.

your answer will be awarded.


You can obviously use the MediaPlayer in AndEngine too, it works fine as it does in Android, because AndEngine is also a part of Android itself.

You can keep your file in res/raw/anyfile.mp3

MediaPlayer mediaPlayer = MediaPlayer
                .create(getApplicationContext(), R.raw.anyfile);
        try {
            mediaPlayer.start();
            mediaPlayer.setLooping(true);
        } catch (Exception e) {
            e.printStackTrace();
        }


though i haven't perform a sound task, but hope this tutorial link will help u,,

http://www.droidnova.com/creating-sound-effects-in-android-part-1,570.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜