Skip to content

Commit ea67aac

Browse files
committed
U MicRecorderAPI.java: fix record twice got wrong filename
1 parent 6c8eaa2 commit ea67aac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/main/java/com/termux/api/apis/MicRecorderAPI.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,18 @@ public RecorderCommandResult handle(Context context, Intent intent) {
254254
int srate = intent.getIntExtra("srate", 0);
255255
int channels = intent.getIntExtra("channels", 0);
256256

257-
file = new File(filename);
257+
File newfile = new File(filename);
258258

259259
Logger.logInfo(LOG_TAG, "MediaRecording file is: " + file.getAbsolutePath());
260260

261-
if (file.exists()) {
261+
if (newfile.exists()) {
262262
result.error = String.format("File: %s already exists! Please specify a different filename", file.getName());
263263
} else {
264264
if (isRecording) {
265265
result.error = "Recording already in progress!";
266266
} else {
267267
try {
268+
file = newfile;
268269
mediaRecorder.setAudioSource(source);
269270
mediaRecorder.setOutputFormat(format);
270271
mediaRecorder.setAudioEncoder(encoder);

0 commit comments

Comments
 (0)