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 2
2
react-native-speech-iflytek 是一个 React Native 下的科大讯飞语音库,可以进行语音识别与语音合成。
3
3
4
4
## 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
6
7
- Android,目前仅支持 Android
7
8
8
9
## Install
@@ -17,7 +18,7 @@ react-native link
17
18
## Usage
18
19
(详见 Example)引入包:
19
20
```
20
- import { Recognizer, Synthesizer } from "react-native-speech-iflytek";
21
+ import { Recognizer, Synthesizer, SpeechConstant } from "react-native-speech-iflytek";
21
22
```
22
23
语音识别:
23
24
```
@@ -63,6 +64,12 @@ onRecognizerResult(e) {
63
64
- `duration`:当前识别时间长度
64
65
- ` onRecognizerVolumeChanged(Int volume) `
65
66
语音识别的音量大小,当识别的语音改变音量时会触发该事件
67
+ - ` onRecognizerError(JSON error) `
68
+ 语音识别出现错误,错误信息与讯飞文档保持一致,其值:
69
+
70
+ - `errorCode`: 获取错误码
71
+ - `errorDescription`: 获取错误描述,不包含错误码的描述信息
72
+ - `plainDescription`: 获取错误描述,包含错误码的描述信息
66
73
67
74
### Synthesizer
68
75
#### Methods
@@ -86,6 +93,12 @@ onRecognizerResult(e) {
86
93
- ` onSynthesizerSpeakCompletedEvent() `
87
94
语音合成播放完成时触发该事件
88
95
96
+ ### SpeechConstant
97
+ 本模块包含讯飞接口的所有常量,如设置发言人、发言速度等,详见讯飞文档,使用示例:
98
+ ```
99
+ Synthesizer.setParameter(SpeechConstant.VOICE_NAME, "xiaoyu");
100
+ ```
101
+
89
102
## Mayebe
90
103
- (Native Android) Android Studio 2.3.3 接入讯飞语音接口: http://www.jianshu.com/p/caf50402d31c
91
104
You can’t perform that action at this time.
0 commit comments