的Soundpool游戏与​​MP3的问题 [英] Soundpool game with mp3 questions

查看:99
本文介绍了的Soundpool游戏与​​MP3的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在游戏将要使用存储在一个MP3问题,所以对于每个问题将有一个MP3文件。

I am making a game which will be using questions stored on a mp3, so for each question there will be a mp3 file.

该用户随后将preSS发挥听MP3,然后添加一个答案的一个EditText领域的MP3。这将然后显示正确或不正确的答案。

The user will then press play to hear the mp3 and then add an answer for the mp3 in an edittext field. Which would then show correct or incorrect answer.

当用户点击确认回答的MP3将移动到下一个问题。因此,当用户presses玩这将是问题2.是否有可能做到这一点,如果是的话,我将如何去实现这一点。我会在这个高度AP preciate任何意见。

When the user clicks confirm answer the mp3 will move to the next question. So when the user presses play it will be question 2. Is it possible to do this and if so how would I go about implementing this. I would highly appreciate any advice on this.

感谢。

推荐答案

建议使用WAV或OGG格式在Android上的声音,但在任何情况下,你可以播放你的MP3用的 MediaPlayer的类。例如:

It is recommended to use WAV or OGG format for sounds on Android, but in any case, you can play back your MP3s with the MediaPlayer class. For example:

MediaPlayer mp = MediaPlayer.create(YourActivityClass.this, R.raw.your_mp3_resource);
if(mp != null) {
    mp.start();
}

阅读有关国家,并呼吁完成的MediaPlayer对象发行()的文档。或者使用一个MediaPlayer对象用的setDataSource()和prepare()方法。

Read the documentation regarding state and calling release() on finished MediaPlayer objects. Alternatively use one MediaPlayer object with the setDataSource() and prepare() methods.

这篇关于的Soundpool游戏与​​MP3的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆