
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
react-native-nj-speech-iflytek
Advanced tools
react-native-speech-iflytek 是一个 React Native 下的科大讯飞语音库,可以进行语音识别与语音合成。
yarn add react-native-speech-iflytek
react-native link
安装、链接后还须进行下面两步(以 Example
工程为例):
语音听写
与在线语音合成
),分别下载 Android 与 iOS 平台 SDK。Android_voice_xxxx_xxxxxxxx/libs
文件夹替换 Example/node_modules/react-native-speech-iflytek/android/libs
文件夹;iOS_voice_xxxx_xxxxxxxx/libs
文件夹替换 Example/node_modules/react-native-speech-iflytek/ios/libs
文件夹。Example/ios/YourProject.xcodeproj
;Example/node_modules/react-native-speech-iflytek/ios/libs/iflyMSC.framework
拖入 Project navigator 的 Frameworks
下,注意选择 Copy items if needed
;4.android平台权限
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--读取网络信息状态 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!--获取当前wifi状态 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!--允许程序改变网络连接状态 -->
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<!--读取手机信息权限 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
(详见 Example)引入包:
import { Recognizer, Synthesizer, SpeechConstant } from "react-native-speech-iflytek";
语音识别:
Recognizer.init("57c7c5b0");
this.recognizerEventEmitter = new NativeEventEmitter(Recognizer);
this.recognizerEventEmitter.addListener('onRecognizerResult', this.onRecognizerResult);
Recognizer.start();
处理识别结果:
onRecognizerResult(e) {
if (!e.isLast) {
return;
}
this.setState({ text: e.result });
}
Recognizer.init(String AppId)
Recognizer.start()
Recognizer.cancel()
Recognizer.isListening()
Promise
,结果为 bool
类型,表示当前是否正在语音识别Recognizer.stop()
Recognizer.setParameter(String parameter, String value)
Recognizer.getParameter(String param)
Promise
,结果为 String
类型,表示语音识别设置值onRecognizerResult(JSON result)
语音识别结果,在语音识别时会不断触发该事件,result
为 JSON
类型,其值:
text
:当次识别结果result
:当前识别结果,最常使用isLast
:是否是最后一次识别,调用 Recognizer.stop()
后,isLast
值为 true
,否则一直为 false
duration
:当前识别时间长度onRecognizerVolumeChanged(JSON result)
语音识别的音量大小,当识别的语音改变音量时会触发该事件,result
为 JSON
类型,其值:
volume
: 当前音量大小onRecognizerError(JSON error)
语音识别出现错误,错误信息与讯飞文档保持一致,其值:
errorCode
: 获取错误码,关于错误码请见官方文档 MSC错误码 :errorType
: (仅 iOS)获取错误码类型errorDesc
: (仅 iOS)获取错误描述errorDescription
: (仅 Android)获取错误描述,不包含错误码的描述信息plainDescription
: (仅 Android)获取错误描述,包含错误码的描述信息Synthesizer.init(String AppId)
Synthesizer.start(String content)
Synthesizer.stop()
Synthesizer.isSpeaking()
Promise
,结果为 bool
类型,表示当前是否正在语音合成Synthesizer.pause()
Synthesizer.resume()
Synthesizer.setParameter(String parameter, String value)
Synthesizer.getParameter(String param)
Promise
,结果为 String
类型,表示语音合成设置值onSynthesizerBufferCompletedEvent()
onSynthesizerSpeakCompletedEvent()
本模块包含讯飞接口的所有常量,如设置发言人、发言速度等,详见讯飞文档,使用示例:
Synthesizer.setParameter(SpeechConstant.VOICE_NAME, "xiaoyu");
iflytek.framework not found
? (见 issue 15)Building Settings
-> Search Paths
-> Framework Search Paths
中手动添加 iflytek.framework
的目录 $(SRCROOT)/../node_modules/react-native-speech-iflytek/ios/libs
。iflytek.framework
拖入时注意选择 Copy items if needed
。如忘记选择,最好的方式是在工程中删除讯飞框架,将讯飞框架移至其他文件夹,并重新拖入工程,选择 Copy items if needed
。(Xcode 的缓存会记住上次选择,若第一次没有Copy items if needed
,在同一位置下重新拖入不会再次出现选择框。)react-native [command]
命令失效?yarn
命令解决依赖。期待提出有关建议,欢迎做出贡献,感谢 star。
Github: https://github.com/zphhhhh/react-native-speech-iflytek
FAQs
Speech module based on iflytekSpeech for react native
The npm package react-native-nj-speech-iflytek receives a total of 1 weekly downloads. As such, react-native-nj-speech-iflytek popularity was classified as not popular.
We found that react-native-nj-speech-iflytek demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.