我使用的服务是:离在线融合SDK安卓
调用的接口是:startListening
参数设置情况:intent.putExtra(BaiduVoiceConst.EXTRA_GRAMMAR, "assets:///s_1");
开发平台和机型:android 7.1,nexus 6p
SDK版本号: 2.1.21
代码或日志截图(上传截图能帮助您更快解决问题):
复现步骤、现象及其他描述:
下载 http://bos.nj.bpc.baidu.com/v1/audio/s_1 离线数据包,放置到 apk assets 下面,设置离线数据包:
// 设置我的 appid,appkey,secretkey
intent.putExtra("appid", GlobalConfig.sBaiduVoiceAppId);
intent.putExtra("key", GlobalConfig.sBaiduVoiceApiKey);
intent.putExtra("secret", GlobalConfig.sBaiduVoiceSecretKey);
// 离线只支持16k
intent.putExtra("sample", 16000);
// 提示音设置
intent.putExtra("sound_start", R.raw.bdspeech_recognition_start);
intent.putExtra("sound_end", R.raw.bdspeech_speech_end);
intent.putExtra("sound_success", R.raw.bdspeech_recognition_success);
intent.putExtra("sound_error", R.raw.bdspeech_recognition_error);
intent.putExtra("sound_cancel", R.raw.bdspeech_recognition_cancel);
// 设置离线数据
intent.putExtra("grammar", "assets:///s_1");
// 离线只支持普通话中文
intent.putExtra("language", "cmn-Hans-CN");
一开始识别,DDMS 就监测到内存猛涨,然后 OOM,app 闪退,开了 largeHeap 都没用。官方的 demo 我试了下,都无法离线的,断网了,就直接无法识别了。不设置离线包,使用在线识别是可以正常识别的。想问下,怎么正确的时候用离线数据包。文档中有几处说法都不一致,我都搞晕了。
kfcmingming:
我使用的服务是:离在线融合SDK安卓
调用的接口是:startListening
参数设置情况:intent.putExtra(BaiduVoiceConst.EXTRA_GRAMMAR, "assets:///s_1");
开发平台和机型:android 7.1,nexus 6p
SDK版本号: 2.1.21
代码或日志截图(上传截图能帮助您更快解决问题):
复现步骤、现象及其他描述:
下载 http://bos.nj.bpc.baidu.com/v1/audio/s_1 离线数据包,放置到 apk assets 下面,设置离线数据包:
// 设置我的 appid,appkey,secretkey
intent.putExtra("appid", GlobalConfig.sBaiduVoiceAppId);
intent.putExtra("key", GlobalConfig.sBaiduVoiceApiKey);
intent.putExtra("secret", GlobalConfig.sBaiduVoiceSecretKey);
// 离线只支持16k
intent.putExtra("sample", 16000);
// 提示音设置
intent.putExtra("sound_start", R.raw.bdspeech_recognition_start);
intent.putExtra("sound_end", R.raw.bdspeech_speech_end);
intent.putExtra("sound_success", R.raw.bdspeech_recognition_success);
intent.putExtra("sound_error", R.raw.bdspeech_recognition_error);
intent.putExtra("sound_cancel", R.raw.bdspeech_recognition_cancel);
// 设置离线数据
intent.putExtra("grammar", "assets:///s_1");
// 离线只支持普通话中文
intent.putExtra("language", "cmn-Hans-CN");
一开始识别,DDMS 就监测到内存猛涨,然后 OOM,app 闪退,开了 largeHeap 都没用。官方的 demo 我试了下,都无法离线的,断网了,就直接无法识别了。不设置离线包,使用在线识别是可以正常识别的。想问下,怎么正确的时候用离线数据包。文档中有几处说法都不一致,我都搞晕了。
回复kfcmingming:
您好,当前不支持离线识别。离线语法功能可以使用。