
Paula is currently the Electronic Media Coordinator at the Scripps Institution of Oceanography at UC San Diego.
(Date:12/9/2016)...... December 09, 2016,... MEDI+SIGN®, a provider of... a new solution for Emergency Departments (ED) has been added to their portfolio.... Department examination rooms, and with a simplified pallet of information available to the...Q:
Read audio file in real time and play it using MediaPlayer in android
I am trying to play audio file using MediaPlayer in real time using BufferedReader.
Here is what I have tried so far
public class ServoClass extends Activity {
MediaPlayer mp;
Button play, stop, pause, stopAll, pauseAll;
int audioResource;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
play = (Button) findViewById(R.id.play);
stop = (Button) findViewById(R.id.stop);
pause = (Button) findViewById(R.id.pause);
stopAll = (Button) findViewById(R.id.stopAll);
pauseAll = (Button) findViewById(R.id.pauseAll);
play.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
readAudioFile();
}
});
}
public void readAudioFile() {
try {
audioResource = getResources().getIdentifier("my_sounds", "raw", getPackageName());
mp = MediaPlayer.create(this, audioResource);
BufferedReader br = new BufferedReader(new FileReader(Environment.getExternalStorageDirectory() + "/media/audio.mp3"));
String line = "";
while ((line = br.readLine())!= null)
Related links:
Comments