File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 22react-native-speech-iflytek 是一个 React Native 下的科大讯飞语音库,可以进行语音识别与语音合成。
33
44## Support
5- - React Native >= 0.43, 低版本未经测试
5+ - React Native >= 0.47.0 from 0.2.0
6+ - React Native >= 0.42.0 from 0.1.2
67- Android,目前仅支持 Android
78
89## Install
@@ -17,7 +18,7 @@ react-native link
1718## Usage
1819(详见 Example)引入包:
1920```
20- import { Recognizer, Synthesizer } from "react-native-speech-iflytek";
21+ import { Recognizer, Synthesizer, SpeechConstant } from "react-native-speech-iflytek";
2122```
2223语音识别:
2324```
@@ -63,6 +64,12 @@ onRecognizerResult(e) {
6364 - `duration`:当前识别时间长度
6465- ` onRecognizerVolumeChanged(Int volume) `
6566语音识别的音量大小,当识别的语音改变音量时会触发该事件
67+ - ` onRecognizerError(JSON error) `
68+ 语音识别出现错误,错误信息与讯飞文档保持一致,其值:
69+
70+ - `errorCode`: 获取错误码
71+ - `errorDescription`: 获取错误描述,不包含错误码的描述信息
72+ - `plainDescription`: 获取错误描述,包含错误码的描述信息
6673
6774### Synthesizer
6875#### Methods
@@ -86,6 +93,12 @@ onRecognizerResult(e) {
8693- ` onSynthesizerSpeakCompletedEvent() `
8794语音合成播放完成时触发该事件
8895
96+ ### SpeechConstant
97+ 本模块包含讯飞接口的所有常量,如设置发言人、发言速度等,详见讯飞文档,使用示例:
98+ ```
99+ Synthesizer.setParameter(SpeechConstant.VOICE_NAME, "xiaoyu");
100+ ```
101+
89102## Mayebe
90103- (Native Android) Android Studio 2.3.3 接入讯飞语音接口: http://www.jianshu.com/p/caf50402d31c
91104
You can’t perform that action at this time.
0 commit comments