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
精彩评论