How to Record Voice | open failed: EPERM (Operation not permitted)

Viewed 15

I want to record a sound file and then save it in mp3 format in the pictures folder, but when starting the code there is an error, the error is given below

            voiceFileName = "1" + ".mp3";
            File audioDir2 = new File("/Sabkino/Voices/SendVoices/");
            if (!audioDir2.exists()) {
                audioDir2.mkdirs();
            }
            recorder = new MediaRecorder();
            recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
            recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
            recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
            File audioDir = new File("/Sabkino/Voices/SendVoices/"+"/"+voiceFileName);
            recorder.setOutputFile(audioDir.getAbsolutePath());
            try {
                recorder.prepare();
                recorder.start();
            }
            catch (Exception e){
                Log.e(TAG, "prepare() failed x1= " + e.getMessage());
            }

This Error : /storage/emulated/0/Pictures/Sabkino/Voices/SendVoices/s.mp3: open failed: EPERM (Operation not permitted)

0 Answers
Related