Chat icon indicating copy to clipboard operation
Chat copied to clipboard

Bug: can't play the audio after recording is completed and before sent it.

Open gzlboy opened this issue 1 year ago • 5 comments

I listen AVPlayerItemFailedToPlayToEndTime event,got "Playback failed with error: The operation could not be completed",i check the audio url / duration / sample, it's all right. What could be the reason for not being able to play?

Have a nice day!

gzlboy avatar Sep 18 '24 08:09 gzlboy

Hey @gzlboy, works ok for me. Does it work if you launch example chat app?

f3dm76 avatar Jan 20 '25 12:01 f3dm76

In your example, test with 2 consecutive records and play them, the play error will appear when playing an unfinished record, choose to play another record. @f3dm76

luongtuananh168 avatar Jan 21 '25 18:01 luongtuananh168

@f3dm76 It is not working in the sample app for me. I record and play and time is always 0 for me.

avinashsingh1987 avatar Jan 22 '25 14:01 avinashsingh1987

@f3dm76 It is not working in the sample app for me. I record and play and time is always 0 for me.

brother did you find any solution ?

EDIT 2: Use these settings

.setRecorderSettings(
				RecorderSettings(
					sampleRate: 12000,
					numberOfChannels: 1,
					encoderBitRateKey: 0
				)
			)

EDIT 1: A potential workaround is to use simpler settings

//			let settings = [
//				   AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
//				   AVSampleRateKey: 12000,
//				   AVNumberOfChannelsKey: 1,
//				   AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
//			   ]
//

This is a screenshot of me directly updating the code in the sample project (and records sucessfully) Image

P.S. - The bug happens on iOS 16 and for some reason the simulator which is iOS 18(?)

mrvfino avatar Mar 13 '25 05:03 mrvfino

I'm also seeing this on-device with ios18

the counter never goes up when I tap the microphone, it's always zero long

singpolyma avatar May 27 '25 13:05 singpolyma