07-20一周傻问题合集

2020-07-21  本文已影响0人  沃特麦冷

i. 集成baiduTTS语音合成到项目中

\color{grey}{—>更换公司账号}
//java.lang.reflect.UndeclaredThrowableException

//{"err_detail":"Params is empty.","err_msg":"parameter error.","err_no":501,"err_subcode":1,"tts_logid":3005497846}
在线语音合成初始化成功,离线语音合成初始化失败
//{"err_msg":"http method not support","err_no":-1001,"expires":0,"time":1595243795} maybe网络差
//
/尝试转换思路,不死磕报错/

—>移除离线语音初始化部分
\color{red}结果是 mSpeechSynthesizer.setAudioStreamType(AudioManager.MODE_IN_CALL); 音频输出参数未设定导致的

ii.仿制NonBlockSyntherizer类改写

@SuppressLint("HandlerLeak")

//该方法一定在新线程中调用

iii.复制文件

//key
  byte[] buffer = new byte[1024];
  int byteRead;
  while (-1 != (byteRead = fileInputStream.read(buffer))) {
      fileOutputStream.write(buffer, 0, byteRead);
  }
            
  fileOutputStream.flush();
上一篇下一篇

猜你喜欢

热点阅读