标签:record eval har 线程 nbsp plist catch bsp sel
因为耗时操作卡线程了
let data = try Data.init(contentsOf: URL.init(fileURLWithPath: file_path!))
改成异步就行了
DispatchQueue.global().async { GXLog(self.iFlySpeechEvaluator.startListening(buffer as Data, params: nil),file: "评测开始回调") DispatchQueue.main.async { let file_path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first?.appending(String(format: "/%@.wav", fileName)) print("文件路径:\(file_path)") do { let data = try Data.init(contentsOf: URL.init(fileURLWithPath: file_path!)) let recordM = RecordManager.shared // let audioData = recordM.convertWavToAmr(path: fileName) let result = self.iFlySpeechEvaluator.writeAudio(data as Data?) if result { print("写入成功") }else { print("写入失败")// } self.iFlySpeechEvaluator.stopListening() }catch let err { GXLog(err) self.iFlySpeechEvaluator.stopListening() } } }
标签:record eval har 线程 nbsp plist catch bsp sel
原文地址:https://www.cnblogs.com/tufei7/p/12378384.html