从SD卡播放的音频文件 [英] Playing audio file from Sdcard

查看:148
本文介绍了从SD卡播放的音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从SD卡播放音频文件。我怎样才能读取音频文件,玩什么呢?下面是我的code来播放音频文件:

I would like to play an audio file from the sdcard. How can I read the audio file and play it? Below is my code to play audio file:

int sound1;
sound1 = mSoundPool.load(this, R.raw.om, 1);
mSoundPool.play(sound1, 1, 1, 1, time - 1, 1);

在这里,在上述$ C $词现在用的Soundpool打从原文件夹中的音频文件,但我需要从SD卡使用的Soundpool播放的音频文件。

Here in the above code i am using soundpool to play the audio file from raw folder but i need to play the audio file from sdcard using soundpool.

现在有兴趣从SD卡播放音频。

Right now interested to play audio from sdcard.

如何达致这?请帮助我需要尽快解决这个问题越好

How to acheive this? please help i need to fix this as soon as possible

推荐答案

使用code以下它为我工作。

Use the code below it worked for me.

MediaPlayer mp = new MediaPlayer();
mp.setDataSource("/mnt/sdcard/yourdirectory/youraudiofile.wav");
mp.prepare();
mp.start();

这篇关于从SD卡播放的音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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