本文整理汇总了Java中com.iflytek.cloud.SpeechError类的典型用法代码示例。如果您正苦于以下问题:Java SpeechError类的具体用法?Java SpeechError怎么用?Java SpeechError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpeechError类属于com.iflytek.cloud包,在下文中一共展示了SpeechError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onError
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onError(SpeechError e) {
//Log.i("LingJu", "识别出错:" + e.getErrorDescription());
if (mRecorder.isRecord() && e.getErrorCode() == ErrorCode.MSP_ERROR_NO_DATA) {
recognizer.startListening(rListener);
} else if (hasValue) {
onSuccess();
} else {
mPlayer.playAssetsFile(context.getResources().getString(R.string.audio_error), false, null);
if (listener != null) {
listener.onError(e.getErrorCode(), e.getErrorDescription());
}
mRecorder.stop(VoiceMediator.get().isWakeUpMode());
setVoiceButton(0);
temp.setLength(0);
}
}
示例2: onCompleted
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onCompleted(SpeechError e) {
// TODO Auto-generated method stub
Log.i(TAG + ".synthesizerListener", "onCompleted,code=" + e);
if (e == null)
emitter.onNext(msg.setState(SpeechMsg.State.Completed));
else {
emitter.onNext(msg.setState(SpeechMsg.State.Error).increaseError());
onError(e.getErrorCode(), e.getErrorDescription(), msg.errorCount());
}
emitter.onComplete();
keepVoiceCtrl(msg);
//VoiceService.get().getRecognizer().setLastRecognized(System.currentTimeMillis());
/*if(e!=null){
IflySynthesizer.this.onError(e.getErrorCode(), e.getErrorDescription(), errorCount);
return;
}*/
//IflySynthesizer.this.onCompleted(progress<100, current_id);
}
示例3: onError
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onError(SpeechError e) {
Log.i("LingJu", "MyRecognizerListener onError()>>>");
//在长时间录音模式下,如果因为无说话内容结束识别则重启
if (mRecorder.isRecord() && long_time_record && long_record_mode != DEFAULT_TAPE && e.getErrorCode() == ErrorCode.MSP_ERROR_NO_DATA) {
recognizer.startListening(RecognizerListener);
return;
}
/*String content = temp.toString();
if (long_time_record && long_record_mode != DEFAULT_TAPE) {
IflyRecognizer.this.onLondRecordResult(content);
mPlayer.playAssetsFile(mContext.getResources().getString(R.string.audio_result), false, null);
temp.setLength(0);
return;
}*/
recognizing = false;
//识别出错时,要及时关闭本地录音器
mRecorder.stop(mediator.isWakeUpMode());
if (!cancel && !mediator.preToCall()) {
mPlayer.playAssetsFile(mContext.getResources().getString(R.string.audio_error), false, null);
}
IflyRecognizer.this.onError(e.getErrorCode(), e.getErrorDescription());
}
示例4: onCompleted
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onCompleted(SpeechError error) {
if (null != mProDialog) {
mProDialog.dismiss();
}
if (error != null) {
switch (error.getErrorCode()) {
case ErrorCode.MSP_ERROR_ALREADY_EXIST:
showTip("authid�Ѿ���ע�ᣬ�����������");
break;
default:
showTip(error.getPlainDescription(true));
break;
}
}
}
示例5: greetToUser
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void greetToUser(String userId) {
view.stopFaceDetectTask();
view.stopCamera();
view.showRobotImg();
ttsModel.speakUserName(userId, new TTSModel.OnTTSFinishListener() {
@Override
public void onTTSFinish(SpeechError speechError) {
if (speechError != null) {
log(speechError.getErrorCode() + ":" + speechError.getErrorDescription());
}
view.startAnimation();
view.setWaveViewEnable(true);
view.setCommentaryButtonEnable(true);
//当进入AI对话模式之后,停止一系列与照相头相关的工作
startAiTalk();
}
});
}
示例6: onResult
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onResult(IdentityResult result, boolean islast) {
Log.d(TAG, result.getResultString());
if (null != mProDialog) {
mProDialog.dismiss();
}
try {
JSONObject object = new JSONObject(result.getResultString());
int ret = object.getInt("ret");
if (ErrorCode.SUCCESS == ret) {
showTip("注册成功");
}else {
showTip(new SpeechError(ret).getPlainDescription(true));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
示例7: onCompleted
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onCompleted(SpeechError error) {
Log.v(TAG,"onCompleted " + String.valueOf(error));
JSONObject obj = new JSONObject();
try {
obj.put(STR_EVENT, EVENT_SPEAK_COMPLETED);
if (error != null) {
obj.put(STR_CODE, error.getErrorCode());
obj.put(STR_MESSAGE, error.getErrorDescription());
}
sendUpdate(obj, true);
} catch (JSONException e) {
e.printStackTrace();
}
}
示例8: onCompleted
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onCompleted(SpeechError error) {
// TODO Auto-generated method stub
if (error == null) {
// bookpage.initNextChapter();
if (bookpage.nextPage()) {
readPos = 0;
bookpage.draw(ReaderActivity.this, isFilp ? nextCanvas
: curCanvas);
pageWidget.invalidate();
SpeechReader.getInstance().speechChapter(
bookpage.getCurPage().toString(), mSynListener);
} else {
readPos = 0;
Toast.show(ReaderActivity.this, "语音播报完成");
}
} else {
readPos = 0;
Toast.show(ReaderActivity.this, "语音播报完成");
}
}
示例9: onLexiconUpdated
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onLexiconUpdated(String id, SpeechError e) {
if (e == null) {
Log.d("Setting.lexiconListener", "id=" + id + ",e=" + e + ",词典更新成功");
} else {
Log.d("Setting.lexiconListener", "id=" + id + "," + e.getErrorDescription());
}
}
示例10: onError
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onError(SpeechError e) {
temp.setLength(0);
//在长时间录音模式下,如果因为无说话内容结束识别则重启
if (status == RecognizeStatus.Recording && e.getErrorCode() == ErrorCode.MSP_ERROR_NO_DATA)
recognizer.startListening(recognizerListener);
else {
status = RecognizeStatus.Idle;
if (listener != null)
listener.onError(e.getErrorCode(), e.getErrorDescription());
}
}
示例11: onCompleted
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
public void onCompleted(SpeechError speechError) {
isPlaying = false;
if (audioManager != null) {
audioManager.abandonAudioFocus(IFlySpeech.this);
}
if (callBack != null) {
if (speechError == null) {
callBack.onCompleted(0);
}
}
}
示例12: onError
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onError(SpeechError speechError) {
if (speechError.getErrorCode() == ErrorCode.ERROR_NO_NETWORK) {
Toast.makeText(getContext(), getContext().getString(R.string.rc_plugin_recognize_check_network), Toast.LENGTH_SHORT).show();
}
if (imgMic != null) {
imgMic.setImageResource(R.drawable.rc_recognize_disable);
}
}
示例13: onCompleted
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onCompleted(SpeechError error) {
if (error == null) {
sendEvent("ttsState","completed");
showTip("播放完成");
} else if (error != null) {
showTip(error.getPlainDescription(true));
}
}
示例14: onLexiconUpdated
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onLexiconUpdated(String lexiconId, SpeechError error) {
if (error != null) {
showTip(error.toString());
} else {
showTip(getString(R.string.text_upload_success));
}
}
示例15: onError
import com.iflytek.cloud.SpeechError; //导入依赖的package包/类
@Override
public void onError(SpeechError error) {
// Tips:
// 错误码:10118(您没有说话),可能是录音机权限被禁,需要提示用户打开应用的录音权限。
// 如果使用本地功能(语记)需要提示用户开启语记的录音权限。
if(mTranslateEnable && error.getErrorCode() == 14002) {
showTip( error.getPlainDescription(true)+"\n请确认是否已开通翻译功能" );
} else {
showTip(error.getPlainDescription(true));
}
}