Piasy / RxAndroidAudio

Maybe the most robust Android Audio encapsulation library, with partial Rx support.
http://blog.piasy.com/2016/02/24/Robust-Android-Audio-encapsulation/
MIT License
1.57k stars 235 forks source link

bug #18

Closed hongtianlei123 closed 7 years ago

hongtianlei123 commented 7 years ago

java.io.IOException: Prepare failed.: status=0x1

How will they solve this error

hongtianlei123 commented 7 years ago

For the first time to use

Piasy commented 7 years ago

I think that's because this library or some other application take the system audio resource, and fail to release it when exit, so any other app can't get prepared for recording.

Try reboot your device?

liyiheng commented 7 years ago

Its's strange. Record on Android 4.4.2 mAudioRecorder.prepareRecord(MediaRecorder.AudioSource.MIC, MediaRecorder.OutputFormat.AAC_ADTS, MediaRecorder.AudioEncoder.AAC, 192000, 192000, mAudioFile); then play the audio file on Android 5.1 , it happens

java.io.IOException: Prepare failed.: status=0x1

liyiheng commented 7 years ago

I tried MediaRecorder.OutputFormat.MPEG_4 at first, but iOS devices couldn't play the audio files well.

Piasy commented 7 years ago

I have never come with this problem before.

How do you play it? do all devices fail to play this audio file? could you please attach the audio file?

liyiheng commented 7 years ago

This AAC_DTS file recorded on Android 4.4.2

Both failed to play as file or url on Android5.1 devices.

Piasy commented 7 years ago

@XanthusL I have tried to play the audio file you attached in two phones.

In Le Mobile(乐视), Android 6.0, API 23, it fail with error code 1 (you can see it in logcat with tag MediaPlayer), which means the file format is unknown.

In Samsung A7, Android 4.4.4, API 19, it fail with error code -38, and detail log is setDataSourceFD failed.: status=0x80000000.

I think it's the problem of the recorder phone, could you please dive deeper into the source code of this lib (clone it and debug)?

liyiheng commented 7 years ago

@Piasy Sorry, I have no idea about this now. There are several output formats and encoders. And there are so many different phones. I just tested with Meizu M2 Note and Huawei Horner 6 Plus.

Now I use this lib to play audios. I have to use lame and AudioRecord to record mp3 audios. This bug seems didn't appear anymore. And it's easy to pause and resume.

Piasy commented 7 years ago

Going to close it, feel free to reopen :)