Can I save the Android recording and click the button to play it?

Asked 1 years ago, Updated 1 years ago, 120 views

in a picture When you press the record button in the left activity, it is recorded and saved as a.3gpp on the sd card.

Then I want to play the file a that I saved when I pressed the button in the activity on the right

How do I code for that?

file io sdcard eclipse-audio external-memory

2022-09-21 15:22

1 Answers

When you click the Play button, you can play the recorded file using the code below by default.

Uriuri = ....; // a stored on sd card.3gpp file path
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(getApplicationContext(), uri);
mediaPlayer.prepare();
mediaPlayer.start();

For more information about playing with Media Player, see the link below.


2022-09-21 15:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.