当前位置: 首页>>代码示例>>Java>>正文


Java ErrorCode类代码示例

本文整理汇总了Java中com.iflytek.cloud.ErrorCode的典型用法代码示例。如果您正苦于以下问题:Java ErrorCode类的具体用法?Java ErrorCode怎么用?Java ErrorCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ErrorCode类属于com.iflytek.cloud包,在下文中一共展示了ErrorCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onError

import com.iflytek.cloud.ErrorCode; //导入依赖的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);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:18,代码来源:VoiceInputComponent.java

示例2: onError

import com.iflytek.cloud.ErrorCode; //导入依赖的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());
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:24,代码来源:IflyRecognizer.java

示例3: onCompleted

import com.iflytek.cloud.ErrorCode; //导入依赖的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;
		}
	}
}
 
开发者ID:JosephPai,项目名称:WithYou,代码行数:19,代码来源:OnlineFace.java

示例4: onContactQueryFinish

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
public void onContactQueryFinish(final String contactInfos, boolean changeFlag) {
	// 注:实际应用中除第一次上传之外,之后应该通过changeFlag判断是否需要上传,否则会造成不必要的流量.
	// 每当联系人发生变化,该接口都将会被回调,可通过ContactManager.destroy()销毁对象,解除回调。
	// if(changeFlag) {
	// 指定引擎类型
	runOnUiThread(new Runnable() {
		public void run() {
			mResultText.setText(contactInfos);
		}
	});
	
	mIat.setParameter(SpeechConstant.ENGINE_TYPE,SpeechConstant.TYPE_CLOUD);
	mIat.setParameter(SpeechConstant.TEXT_ENCODING, "utf-8");
	ret = mIat.updateLexicon("contact", contactInfos, mLexiconListener);
	if (ret != ErrorCode.SUCCESS) {
		showTip("上传联系人失败:" + ret);
	}
}
 
开发者ID:SoulEaterVTT,项目名称:KotlinStudy,代码行数:20,代码来源:IatDemo.java

示例5: onResult

import com.iflytek.cloud.ErrorCode; //导入依赖的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();
    }
}
 
开发者ID:SoulEaterVTT,项目名称:KotlinStudy,代码行数:22,代码来源:OnlineFaceDemo.java

示例6: onCreate

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.isvdemo);

	initUi();

	mIdVerifier = IdentityVerifier.createVerifier(VocalVerifyDemo.this, new InitListener() {

		@Override
		public void onInit(int errorCode) {
			if (ErrorCode.SUCCESS == errorCode) {
				showTip("引擎初始化成功");
			} else {
				showTip("引擎初始化失败,错误码:" + errorCode);
			}
		}
	});
}
 
开发者ID:SoulEaterVTT,项目名称:KotlinStudy,代码行数:21,代码来源:VocalVerifyDemo.java

示例7: onContactQueryFinish

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
public void onContactQueryFinish(final String contactInfos, boolean changeFlag) {
    // 注:实际应用中除第一次上传之外,之后应该通过changeFlag判断是否需要上传,否则会造成不必要的流量.
    // 每当联系人发生变化,该接口都将会被回调,可通过ContactManager.destroy()销毁对象,解除回调。
    // if(changeFlag) {
    // 指定引擎类型
    runOnUiThread(new Runnable() {
        public void run() {
            mResultText.setText(contactInfos);
        }
    });

    mIat.setParameter(SpeechConstant.ENGINE_TYPE,SpeechConstant.TYPE_CLOUD);
    mIat.setParameter(SpeechConstant.TEXT_ENCODING, "utf-8");
    ret = mIat.updateLexicon("contact", contactInfos, mLexiconListener);
    if (ret != ErrorCode.SUCCESS) {
        showTip("上传联系人失败:" + ret);
    }
}
 
开发者ID:harrynull,项目名称:PowerScore,代码行数:20,代码来源:Listener.java

示例8: doVoiceInput

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Permission(PermissionUtils.CODE_AUDIO)
private void doVoiceInput() {
    boolean has = PermissionUtils.hasPermission4Audio(mContext);
    if (has) {
        mIsVoiceOpen = true;
        if (mIat == null) {
            // 使用SpeechRecognizer对象,可根据回调消息自定义界面;
            mIat = SpeechRecognizer.createRecognizer(mContext, mInitListener);
        }
        //todo 如果是title怎么办
        mContentString = mEditTextView.getNoteContent();
        setVoiceParam();
        ret = mIat.startListening(mRecognizerListener);
        if (ret != ErrorCode.SUCCESS) {
            YLog.e(TAG, "听写失败,错误码:" + ret);
        }
    } else {
        PermissionUtils.requestPermissions(mActivity, mContext.getString(R.string.permission_audio),
                PermissionUtils.PERMISSION_AUDIO, PermissionUtils.CODE_AUDIO, null);
    }
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:22,代码来源:EditTextPresenterImpl.java

示例9: onInit

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
public void onInit(int code) {
    if (code != ErrorCode.SUCCESS) {
        Log.d("gaolei","----------------");
    } else {
        // 初始化成功,之后可以调用startSpeaking方法
        // 注:有的开发者在onCreate方法中创建完合成对象之后马上就调用startSpeaking进行合成,
        // 正确的做法是将onCreate中的startSpeaking调用移至这里
        Log.d("gaolei","----------------");

    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:SpeechUtil.java

示例10: onInit

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
public void onInit(int code) {
    Log.i(TAG, "SpeechRecognizer init() code = " + code);
    if (code == ErrorCode.SUCCESS) {
        Log.i(TAG + ".rInitListener", "speechRecognizer init success!");
        setRecognizeParams();
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:9,代码来源:VoiceInputComponent.java

示例11: onTapeResult

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
/**
 * 结束录音模式时调用
 **/
@Override
public void onTapeResult(final String tapeContent) {
    if (TextUtils.isEmpty(tapeContent)) {
        currentAction.setOutc(1);
        onRecognizeError(ErrorCode.MSP_ERROR_NO_DATA, Setting.RECOGNIZE_NODATA_ERROR);
        return;
    }
    //退出录音模式
    IflyRecognizer.getInstance().setRecognizeMode(false);
    String tapePath = PcmRecorder.TAPE_SRC + System.currentTimeMillis() + ".amr";
    //压缩并保存录音文件
    AmrEncoder.pcm2Amr(PcmRecorder.TEMP_FILE, tapePath);
    final Tape tape = new Tape();
    tape.setText(tapeContent);
    tape.setUrl(tapePath);
    tape.setCreated(new Date());
    tape.setSynced(false);
    //保存录音记录
    TapeEntityDao.getInstance().insertTape(tape);
    //上传录音对象方式1(新策略,暂未实现)
    // uploadTapeEntity(tape);
    // Log.i("LingJu", "onSyncComplete()>>>" + tape.getSid());

    TapeEntityDao.getInstance().setOnSyncListener(new TapeEntityDao.OnSyncListener() {
        @Override
        public void onSyncComplete() {
            Log.i("LingJu", "onSyncComplete()>>>" + tape.getSid());
            onRecoginzeResult(tapeContent + "&" + tape.getSid());
        }
    });
    ////上传录音对象方式2(同步记录)
    TapeEntityDao.getInstance().sync();
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:37,代码来源:VoiceMediator.java

示例12: onInit

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
public void onInit(int code) {
    // TODO Auto-generated method stub
    Log.d(TAG, "SpeechSynthesizer init() code = " + code);
    if (code == ErrorCode.SUCCESS) {
        initParam = true;
        Log.i(TAG + ".sinitListener", "SpeechSynthesizer init success!");
        resetParam();
        SynthesizerBase.instance = instance_;
        SynthesizerBase.inited = true;
    }
    if (mediator != null) {
        mediator.onSynthesizerInited(code);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:16,代码来源:IflySynthesizer.java

示例13: onInit

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
public void onInit(int code) {
    Log.d(TAG, "SpeechRecognizer init() code = " + code);
    if (code == ErrorCode.SUCCESS) {
        initParam = true;
        Log.i(TAG, "speechRecognizer init success!");
        setDefaultRecognizerParam(false);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:10,代码来源:IflyRecognizer.java

示例14: onResult

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
public void onResult(RecognizerResult result, boolean isLast) {
    recognize_end_moments = System.currentTimeMillis();
    if (null != result && result.getResultString().length() > 2) {
        // 显示
        Log.i(TAG, "recognizer result:" + result.getResultString());
        temp.append(AudioJsonParser.parseIatResult(result.getResultString()));
    } else {
        Log.i(TAG, "recognizer result : null");
    }
    if (isLast) {
        if (temp.length() <= 0) {
            if (mRecorder.isRecord() && long_time_record && long_record_mode != DEFAULT_TAPE)
                recognizer.startListening(RecognizerListener);
            else {
                Log.i("LingJu", "MyRecognizerListener onResult()>>>> error");
                mPlayer.playAssetsFile(mContext.getResources().getString(R.string.audio_error), false, null);
                IflyRecognizer.this.onError(ErrorCode.MSP_ERROR_NO_DATA, "");
            }
            return;
        }
        String content = temp.toString();
        //如果已开启长时间录音,则在识别自动结束时重启识别
        if (mRecorder.isRecord() && long_time_record && long_record_mode != DEFAULT_TAPE) {
            onSuccess(content);
            recognizer.startListening(RecognizerListener);
            return;
        }
        recognizing = false;
        onSuccess(content);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:33,代码来源:IflyRecognizer.java

示例15: onInit

import com.iflytek.cloud.ErrorCode; //导入依赖的package包/类
@Override
public void onInit(int code) {
    if (code == ErrorCode.SUCCESS) {
        Log.i(TAG, "speechRecognizer init success!");
        setDefaultRecognizerParam();
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:8,代码来源:LingJuCloudAwakener.java


注:本文中的com.iflytek.cloud.ErrorCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。