我下载了离在线消息的sdk,里面包含的apk是可以正常运行的。但是我把demo导入as运行之后,在运行点按模式之后,操作失踪收不到任何回馈反应。而我根据文档中心的描述进行调用也是没有正确运行。
intent.putExtra("infile","res:///com.example.sungoin.speechtotexttest/16k_test.pcm");intent.putExtra("sample", 16000); // 离线仅支持16000采样率
intent.putExtra("language", "cmn-Hans-CN"); // 离线仅支持中文普通话
intent.putExtra("prop", 20000); // 输入
intent.putExtra("lm-res-file-path", "s_2_InputMethod");
这是我的参数传入,在log中打印出了设备号,二次执行则会有Rejecting re-init on previously-failed class java.lang.Class的提示。请问这是什么原因导致的?
在运行demo代码的时候,会报信息:
QCMediaPlayer mediaplayer NOT present
Should have subtitle controller already set
并有异常信息:
java.lang.Exception: #3, Audio recording error., file: null
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at com.baidu.speech.AsrSession.createMicrophoneInputStream(AsrSession.java:175)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at com.baidu.speech.AsrSession.onExecute(AsrSession.java:249)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at com.baidu.speech.AbsSession.run(AbsSession.java:73)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at java.lang.Thread.run(Thread.java:841)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: Caused by: java.lang.InterruptedException
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at java.lang.VMThread.sleep(Native Method)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at java.lang.Thread.sleep(Thread.java:1013)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at java.lang.Thread.sleep(Thread.java:995)
05-18 11:01:13.498 6358-6532/baiduvoice.android.aeulus.com.bdtest W/System.err: at com.baidu.speech.AsrSession.createMicrophoneInputStream(AsrSession.java:143)
这个有是什么原因呢?
谢谢
intent.putExtra("lm-res-file-path", "s_2_InputMethod");
这里要求是一个可以找到s_2_InputMethod的文件路径,需要把该文件“放置”到固定的手机目录